EG H167 1:30 Sec. Winter 2001 Daily Assignment D14Advanced
For the D14 Advanced assignment:
1. Complete the regular D14 assignment which introduces use of arrays of pointers in sorting applications and the use of some string handling functions.
2. Complete the following as additions to your program in Step 1 above:
a). In previous assignment, we wrote a "swap" function to do the interchanging of values when sorting the diameters of the wrist pins. In that assignment, the "swap" function had to interchange two floating-point values. In this assignment, you are to implement a "swap" function that interchanges the two character pointer values. (Hint: How would we define a pointer to a pointer?)
b). Your implementation of this assignment should not use a fixed number to read in the data from the data file. Your program must properly detect the end-of-file while reading the names and correctly sort this "unknown" number of names. Obviously, an experienced programmer would need to make some assumptions about how many names his/her program would be capable of handling. You may assume that there are no more than 20 names, but you must include the logic to avoid trying to read more than 20 names while at the same time trying to detect how many names there are by reading until the end-of-file. Provide an appropriate message if the file to be processed contains more than the number of names your program will support. (Test this.)