Question: I need to know how I would code this in C++ This is the contents of the candidates.txt file. Instructions Write a program called voter.cpp

I need to know how I would code this in C++

I need to know how I would code this in C++ This

This is the contents of the candidates.txt file.

is the contents of the candidates.txt file. Instructions Write a program called

Instructions Write a program called voter.cpp that uses three parallel vectors: candidates, votes and percents. They should be declared as string, int, and double, respectively. Your program should read the file candidates.txt into the vector, candidates. This file is on Canvas under the Week 8 module. The program should then fill the votes vector with random numbers between 1500 and 9000 the votes vector should be the same size as the candidates vector Determine the total number of votes for all candidates and fill the percents vector with the percentage for each candidate. Finally, print the names of the candidates, their vote totals and percentages, and the election results to both the console and an output text file. Your output file should look like your console output, e.g. Candidate Votes Percent Johnson Crosby Guffy Mancini Hong Fremont Iglesias Bronski Huffnagle Maata Malkin Polamalu 0 Brien Fahd Santini Rodriguez 4614 7725 2525 2609 6746 2446 5139 6005 3885 4853 6116 5916 3755 2993 5104 7188 5.9% 10 , 0% 3.3% 3.4% 8.7% 3.2% 6.6% 7.7% 5.8% 6.3% 7.9% 7.6% 4.8% 3.9% 6.6% 9.3% The winner is Crosby with 7725 votes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!