68 425
Assignments Done
98,6%
Successfully Done
In December 2018

Answer to Question #22770 in C++ for Kim

Question #22770
Write a whole program for presidential Elections, the user will enter his votes based on the code for each candidate. The Program will add the total votes for each candidate and proclaim the winner whoever got the most number of votes. The user will stop in accepting votes if the used entered Letter ‘Q’ to quit. Type ‘V’ to vote and ‘R’ to view the result.
Expert's answer
#include <iostream>

using namespace std;

int main()
{ int voutes[10];

cout<<"how many candidates? please enter number"<<endl;
int n;
cin>>n;
int summ;
int sum[n];
int max=0;
for(int i=1;i<=n;i++)
{
cout << "please enter votes of candidate" <<i<<endl;

for(int j=1;j<=10;j++)
{
& cin>>voutes[j];
& cout<<endl;
& summ=summ+voutes[j];
}
sum[i]=summ;
cout<<"sum of candidats "<<i<<" ="<<sum[i]<<endl;

if(sum[i]>max)
{
& max=sum[i];

& }
sum[i]=0;
}
cout<<"max= "<<max<<endl;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions