Question: c++ Write a program named plurality.cpp that: Maintains three parallel vectors named candidates, votes, and percents o candidates is of type string o votes is
c++
Write a program named plurality.cpp that: Maintains three parallel vectors named candidates, votes, and percents o candidates is of type string o votes is of type int o percents is of type double Reads from a text file named candidates.txt, populating the candidates vector o candidates.txt will be provided Populates the votes vector with random numbers between 1500 and 9000, indicating the number of votes for each candidate
candidates
Johnson Crosby Guffy Mancini Hong Fremont Iglesias Bronski Huffnagle Maata Malkin Polamalu O'Brien Fahd Santini Rodriguez
sample out put:
Candidate Votes Percent
Johnson 4614 5.9%
Crosby 7725 10.0%
Gruffy 2525 3.3%
Mancini 2609 3.4%
Hong 6746 8.7%
Fremont 2446 3.2%
Iglesias 5139 6.6%
Bronski 6005 7.7%
Huffnagle 3885 5.0%
Maata 4853 6.3%
Malkin 6116 7.9%
Polamalu 5916 7.6%
O'Brien 3755 4.8%
Fahd 2993 3.9%
Santini 5104 6.6%
Rodriguez 7188 9.3%
The winner is Crosby with 7725 votes and 10.0% of the vote
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
