Question
MAKE A C PROGRAM. Company ballots require that voters rank all the candidates in order of choice. Fixed values (Constants) Candidate ID Candidate Name John
MAKE A C PROGRAM.
Company ballots require that voters rank all the candidates in order of choice.
Fixed values (Constants)
Candidate ID Candidate Name
John Doe
Jane Smith
Jay Roberts
Input
Up to 1,000 lines, each containing the contents of a ballot. Each ballot contains the numbers from 1 to 3 in some order. The rst number indicates the candidate ID of rst choice; the second number indicates candidate ID of second choice, and the third number indicates candidate ID of third choice. The input will be terminated by a line containing three zeros, which should not be processed. Conflicting inputs are allowed (e.g 3 3 1)
Output
The program will ignore ballots with conflicting inputs (e.g. 1 2 2). The output of each test case consists of the total point earned by each candidate (1 point for First Choice, 2 points for Second Choice, 3 points for Third Choice). Then either a single line containing the name of the winner or several lines containing the names of all candidates who are tied. The output of each two consecutive cases are separated by a blank line.
Sample Input
1 2 3
2 1 3
2 3 1
1 2 3
3 1 2
1 3 2
0 0 0
Sample Output
John Doe= 10pts
Jane Smith= 12pts
Jay Roberts= 14pts
Winner: John Doe
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started