September 2015
Beginner
110 pages
2h 6m
English
| 41 | Name Sorter |
Alphabetizing the contents of a file, or sorting its contents, is a great way to get comfortable manipulating a file in your program.
Create a program that reads in the following list of names:
| | Ling, Mai |
| | Johnson, Jim |
| | Zarnecki, Sabrina |
| | Jones, Chris |
| | Jones, Aaron |
| | Swift, Geoffrey |
| | Xiong, Fong |
Read this program and sort the list alphabetically. Then print the sorted list to a file that looks like the following example output.
| | Total of 7 names |
| | ----------------- |
| | Ling, Mai |
| | Johnson, Jim |
| | Jones, Aaron |
| | Jones, Chris |
| | Swift, Geoffrey |
| | Xiong, Fong |
| | Zarnecki, Sabrina |
Don’t hard-code the number of names.
Implement this program by reading in the names from the user, one at a time, and printing out the ...
Read now
Unlock full access