Chapter 7 - Maps
Exercise 2: Sorting Map Keys
Here’s a new
votes.txt file. It’s been updated to list candidate names in “last name, first name” order, and there are several more candidate names now.
Wilkins, Dennis Rodriquez, Jamie Hines, Domingo Wolfe, Kelly Carr, Darla Rodriquez, Jamie Wolfe, Kelly Wilkins, Dennis Carr, Darla Rodriquez, Jamie Hines, Domingo
Our vote counting program still works with this updated file, but we’re really starting to wish the results were easier to read. Update the program to print the candidates in alphabetical order by name.
Votes for Carr, Darla: 2 Votes for Hines, Domingo: 2 Votes for Rodriquez, Jamie: 3 Votes for Wilkins, Dennis: 2 Votes for Wolfe, Kelly: 2