# Project 19

More functions & Bubble Sort(100 points)
• Your main program should contain five procedure funtions - one which will allow the input of a set of floats, another to bubble sort the list of floats in ascending order, a third to bubble sort a list of floats in descending order, a fourth to output a list of floats, and a fifth to find the median.
• To fill your array of floats, enter a posttest loop and accept a real number as a string. Your string should allow up to nine characters. Check the first character of the string. Remember, a string is an array of characters, so if stg is the string, then stg[0] is the first character of that string. Using the isdigit function (uses ctype.h), check to see if the first character is not a digit. If it is not a digit, then break out of the loop to terminate the entry of string numbers. If the first character is a digit, then convert the entire string to a float, store it into a one-dimentional array, and go back to the top of the loop to pickup another string number.
• Using sample output 1 as an example, your one-dimentional array should be filled in the following manner :
```num[0] = 4.3  num[1] = 7      num[2] = 1  num[3] = 8.4
num[4] = 5    num[6] = 8.3    num[7] = 6
```
• Even though the sample output suggests three different ways of displaying the data (original, ascending, and descending), you will only have one function that will output a list. Each time you call the output function, your array of floats will be arranged in a different order. Your output function should dump a single list the same way each time it is called no matter what order the elements are positioned.
• After you fill the array of floats and dump it out, call a function which will bubble sort your list in ascending order.
• After the ascending order bubble sort, your one-dimentional array should be filled in the following manner :
```num[0] = 1    num[1] = 4.3      num[2] = 5  num[3] = 6
num[4] = 7    num[6] = 8.3      num[7] = 8.4
```
• Next, call the same output function to dump out the ascending list.
• After you dump the ascending list, send the array over to a different bubble sort function. This function should resort the list in descending order.
• After the descending order bubble sort, your one-dimentional array should be filled in the following manner :
```num[0] = 8.4    num[1] = 8.3      num[2] = 7  num[3] = 6
num[4] = 5      num[6] = 4.3      num[7] = 1
```
• Calculate the median and return to the main program where you will output the result.
• Next, call the same output function to dump out the descending list.
• Make sure your program can display the sample outputs below.
• Your code must be well documented. Also include your name, date, project number and a breif description of the program.

```
Sample output 1

Enter number 1 or a letter to quit: 4.3
Enter number 2 or a letter to quit: 7
Enter number 3 or a letter to quit: 1
Enter number 4 or a letter to quit: 8.4
Enter number 5 or a letter to quit: 5
Enter number 6 or a letter to quit: 8.3
Enter number 7 or a letter to quit: 6
Enter number 8 or a letter to quit: q

original data = 4.3 , 7 , 1 , 8.4 , 5 , 8.3 , 6
ascending data = 1 , 4.3 , 5 , 6 , 7 , 8.3 , 8.4
descending data = 8.4 , 8.3 , 7 , 6 , 5 , 4.3 , 1
Median = 6

Sample output 2

Enter number 1 or a letter to quit: 5.6
Enter number 2 or a letter to quit: 7.2
Enter number 3 or a letter to quit: 6
Enter number 4 or a letter to quit: 4.2
Enter number 5 or a letter to quit: 9
Enter number 6 or a letter to quit: 7.1
Enter number 7 or a letter to quit: u

original data = 5.6 , 7.2 , 6 , 4.2 , 9 , 7.1
ascending data = 4.2 , 5.6 , 6 , 7.1 , 7.2 , 9
descending data = 9 , 7.2 , 7.1 , 6 , 5.6 , 4.2
Median = 6.55

Sample output 3

Enter number 1 or a letter to quit: 6.1
Enter number 2 or a letter to quit: g

original data = 6.1
ascending data = 6.1
descending data = 6.1
Median = 6.1
```