Write Program Allows User Enter Last Names Five Candidates Local Election Number Votes Rec Q37080442

Write a program that allows the user to enter the last names offive candidates in a local election and the number of votesreceived by each candidate. The program should then output eachcandidate’s name, the number of votes received, and the percentageof the total votes received by the candidate. Your program shouldalso output the winner of the election. A sample output is:

Candidate

Votes Received

% of Total Votes

Johnson

5000

25.91

Miller

4000

20.73

Duffy

6000

31.09

Robinson

2500

12.95

Ashtony

1800

9.33

Total

19300

The Winner of the Election is Duffy.

Submit your working source code (10 points)

Necessary comments ( 5 points)

General pseducode ( 5 points)


Solution


#include<iostream>

#include<iomanip>

#include<vector>

using namespacestd;

int main()

{

   vector<string>name;

   vector<int>votes;

   

    // store the total no of votes

    int total_votes =0;

   

    //

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.