Question: C++ 1. Write a program that allows the user to enter the last names offive candidates in a local election and the votes received by

C++

1. Write a program that allows the user to enter the last names offive candidates in a local election and the votes received by each candidate. The program should then output each candidates name, votes received by that candidate, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is as follows: Candidate Johnson Miller Duffy Robinson Sam Total Votes Received 5000 4000 6000 2500 1800 19300 The Winner of the Election is Duffy.

#include #include

using namespace std; int main() { int winIndex = 0; int max = 0; int total=0; string candiName[5]; int candiVotes[5]; for (int i = 0; i<5; i++) { cout << "Enter Candicate " << (i + 1) << " Name : "; cin >> candiName[i]; cout << "Enter Candicate " << (i + 1) << " Votes : "; cin >> candiVotes[i]; cout << " "; total += candiVotes[i]; if (max

NOW THIS IS MY QUESTION

can you please Modify this solution

1. reading an arbitrary number of names and votes from a file

2. recognizing more than 1 winning candidate - several candidates with the greatest number of 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!