Redo the Election Results programming example of Chapter 18 so that it uses the STL class list to process candidates data. The program (in main.cpp
Redo the Election Results programming example of Chapter 18 so that it uses the STL class list to process candidates data.
The program (in main.cpp) should:
Read data from candData.txt and voteData.txt
Print out the number of votes each candidate received in each region
Print the winners name and votes received in the following format:
Winner: Sheila Bower, Votes Received: 493
Print the total number of votes in the following format:
Total votes polled: 2216
An example of the program is shown below:
--------------------Election Results-------------------- Votes Candidate Name Region1 Region2 Region3 Region4 Total ------------------ ------- ------- ------- ------- ------ Sheila Bower 23 70 133 267 493 Danny Dillion 25 71 156 97 349 Lisa Fisher 110 158 0 0 268 Greg Goldy 75 34 134 0 243 Peter Lamba 285 56 0 46 387 Mickey Miller 112 141 156 67 476 Winner: Sheila Bower, Votes Received: 493 Total votes polled: 2216
candData.txt
Greg Goldy Mickey Miller Lisa Fisher Peter Lamba Danny Dillion Sheila Bower
voteData.txt
Greg Goldy 2 34 Mickey Miller 1 56 Lisa Fisher 2 56 Peter Lamba 1 78 Danny Dillion 4 29 Sheila Bower 4 78 Mickey Miller 2 63 Lisa Fisher 1 23 Peter Lamba 2 56 Danny Dillion 1 25 Sheila Bower 2 70 Peter Lamba 4 23 Danny Dillion 4 12 Greg Goldy 3 134 Sheila Bower 4 100 Mickey Miller 3 67 Lisa Fisher 2 67 Danny Dillion 3 67 Sheila Bower 1 23 Mickey Miller 1 56 Lisa Fisher 2 35 Sheila Bower 3 78 Peter Lamba 1 27 Danny Dillion 2 34 Greg Goldy 1 75 Peter Lamba 4 23 Sheila Bower 3 55 Mickey Miller 4 67 Peter Lamba 1 23 Danny Dillion 3 89 Mickey Miller 3 89 Peter Lamba 1 67 Danny Dillion 2 37 Sheila Bower 4 89 Mickey Miller 2 78 Lisa Fisher 1 87 Peter Lamba 1 90 Danny Dillion 4 56
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started