[Previous Homework] [Next Homework]

hw17 - Arrays 2


Modify the arrayGradesFun.c program to also display the median grade from the class.

  • Add a function to find the median value
    • Pass in the array of grades
    • Use Bubble Sort to sort the array (see below)
    • Return the median value from the function
  • Pass the median value to the PrintResults() function and print it with the other output


Bubble Sort Pseudocode:
	repeat
		hasChanged := false
		decrement itemCount
		repeat with index from 1 to itemCount
			if (item at index) > (item at (index + 1))
				swap (item at index) with (item at (index + 1))
				hasChanged := true
	until hasChanged = false


Bubble Sort Dance:
Bubble Sort Legos:

From Linux on the GL machine:
  • Compile the program:
    gcc -o array2 array2.c

  • Run the program to make sure it works:
    ./array2

  • Use the SUBMIT utility turn in the homework.
    submit cs104_grasso hw17 array2.c array2


Reference Programs :



Make sure that you follow all the coding standards