Homework 24: Sorting
Name: _____________________________________________ Alpha: ___________________
Describe help received: ________________________________________________________
- Due before class on Wednesday, March 22
- This homework contains code to be submitted electronically.
Put your code in a folder called
hw24and submit using the204subcommand. - This is an electronic homework and you do not need to print out anything to turn in during class.
Assignment
- Required reading: Sections 1 (Function Design) and 2 (Sorting), but not including section 2.4, from the Unit 7 notes,
- Write a program called
sort6.c that reads in 6 numbers from
the user and prints them out from largest to smallest.
Of course, you should store them in an array and write a function to sort that array in largest-to-smallest order.
Example runs:
roche@ubuntu$./sort6Enter 6 numbers:1 2 3 4 5 6654321
roche@ubuntu$./sort6Enter 6 numbers:32 1 18 3 3 10321810331
roche@ubuntu$./sort6Enter 6 numbers:7 7 8 5 20 62087765