Question: C + + Write a program that allows the user to enter the last names of five candidates in a local election and the number

C++ Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidates name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election.
You will need three parallel arrays for your candidate data. One is for the candidates' last names, one is for the votes received by each candidate, and one is for the calculated percentages of the total votes received by each candidate. You will need to calculate the percentages from the voting data in the array that stores the votes received by each candidate.
Your program must contain AT LEAST the following functions:
readCandidateData - This void function will read the candidate's last names and votes received. Don't forget that arrays are passed by reference in C++.
sumVotes - The function will accept the votes array as an argument and return the sum of the votes stored in the array.
determineWinner - This function will accept the last name and votes arrays as arguments and return the index number of the winner.
print - This void function will print the results of the election. The results must be formatted like they are in the sample output below. All decimal numbers must be formatted to two decimal places in your output.

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!