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 sorted results to a file.
Use the program to sort data from a large data set and see how well it performs.
Implement this program in a functional programming language and compare the programs.
3.142.43.216