CIS 067 Section 1
Fall, 2001
Assignment 6F2001
Sorting Arrays of Structs
Do Programming Project 11 (p. 479) in the Friedman/Koffman Text,
3rd Edition with the following additions.
- Start with a single set of data records (lines) each of which contains
- a person's last name
- their personal worth (in millions of dollars)
For example:
Getty 1000 (John Paul Getty, worth 1000 million or 1 billion dollars)
Hess 550
Gates 36000
Forbes 47500
(Make up another 19 data records
- You may assume there are NO duplicates in the file and therefore you do
not need to worry about the third case described in the problem in the book.
- Start by reading the data in your file and distributing this data into
two arrays of structs each of size 20.
- Display the contents of the two arrays when done distributing.
- Sort the data in the two arrays in descending order by personal worth.
Use the C standard library function qsort to do this. Display the contents of the two
arrays after the sort.
- Call a function merge_arrays to merge the data in the two arrays into a
third array of structs of size 30 so that all data is sorted in descending order by
personal worth when you are done.