Question
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
out of 10.00
Election summary printed
Click the checkbox above to attempt this task.
Checks
Code PatternIncomplete
Did not hard code the program output
Test CaseIncomplete
Election data 1
0.00 out of 10.00
STL header file included
Click the checkbox above to attempt this task.
Checks
Code PatternIncomplete
Include list header file
0.00 out of 10.00
STL methods used
Click the checkbox above to attempt this task.
Checks
Code PatternIncomplete
Variable of type list
Code PatternIncomplete
Candidate list sorted with the sort method of the STL class list
Code PatternIncomplete
push_back used to add items to list variable
Code PatternIncomplete
iterator of type list
main.cpp:
#include
using namespace std;
int main() {
// Write your main here
return 0;
}
Programming Exercise 21-1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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