Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(PRogramming Language C++) Write a program that allows the user to enter the las

ID: 3666525 • Letter: #

Question


(PRogramming Language C++)

Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate.

The program should then output each candidate’s 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. Provide documentation of code using " // " after lines of code with a brief explanation of what was done in the line of code

A sample output is as follows:

Total : 19,300

The Winner of the Election is Duffy.

Candidate Votes Received % % of Total Votes Johnson 5000 25.91 Miller 4000 20.72 Duffy 6000 31.09 Robinson 2500 12.95 Sam 1800 9.33

Explanation / Answer

#include<iostream.h>

#include<conio.h>

using namespace std;

int size=100;

class election

{

int candidates;

int vote[size];

cout<<“Enter the candidates name”;

cout<<“Enter the number of votes received by candidates”;

cout<<“Enter the candidates percentage of votes”;

for(int i=0;i<25;i++)

{

cin>>votes_received[i];

}

for(int i=1;i<10;i++)

{

maximum=votes_percentage;

if(votes_percentage>max)

{

winner=a;

}

cout<<“candidates”<<“votes received”<<“percentage of votes”;

{

cout<<“The winner of the election is”<<candidate[winner]

return 0;

}