Answered You can hire a professional tutor to get the answer.

QUESTION

Please write C++ program that reads a local election result file (called "votes.txt"): 5 Johnson5000 Miller4000 Duffy6000 Robinson2500 Anthony1800...

Please write C++ program that reads a local election result file (called "votes.txt"):

5

Johnson   5000

Miller        4000

Duffy        6000

Robinson  2500

Anthony   1800

(note: the number 5 in the first row is the number of candidates)

The program should use array(s) to store the information, manipulate the data, then output each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate to a local file called "result.txt" with the following format:

Candidate         Votes Received         % of Total Votes

Johnson            5000                          25.91

Miller                 4000                          20.73

Duffy                 6000                          31.09

Robinson           2500                         12.95

Anthony            1800                          9.33

Zip your source code (.cpp file(s)), input file ("votes.txt"), and output file ("result.txt") in a zip file and name it FirstName_LastName_Lab1.zip. Submit this zipped file here when ready.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question