Respuesta :

Answer:

Written in C++

#include<iostream>

using namespace std;

void election(string names[], int votes[]){

int total = 0;

for(int i= 0;i<5;i++){

 total+=votes[i];

}

cout<<"Candidate\t\tVotes Received\t\t% of Total Votes"<<endl;

for(int i =0;i<5;i++)  {

 cout<<names[i]<<"\t\t\t"<<votes[i]<<"\t\t\t";

 printf("%.2f", (votes[i]  * 100.00/total));

 cout<<endl;

}

cout<<"Total: "<<total;  

}

int main() {  

string names[5] ;int votes[5];

cout<<"Enter Lastname of each candidate: "<<endl;

for(int i =0;i<5;i++) {

 cin>>names[i];

}

cout<<"Enter result of each candidate: "<<endl;

for(int i =0;i<5;i++) {

 cin>>votes[i];

}

election(names,votes);

return 0;

}

Explanation:

I've added the the full program as an attachment where I used comments to explain difficult lines

Ver imagen MrRoyal