as tabled below : Candidate A Candidate B Candidate C Candidate D Faculty 1 192 48 206 37 Faculty 2 147 90 312 21 Faculty 3 186 12 121 38 Faculty 4 114 21 408 39 Faculty 5 267 13 382 29 Write a program to do the following:
a. Display the table with appropriate labels for rows and columns Create function to do this : void printArray(int arr[])
b. Compute and display the total number of votes received by each candidate and the percentage of the total votes casts Store total number of votes received by each candidate in an array: int candidateVotes[]; Store percentage of votes received in another array: double candidateVotesPercent[];
c. (i) If any one candidate received 50% of the votes, the program should display a message declaring that the candidate is the winner.
(ii)If no candidate received 50% of the votes, the program should display a message showing the top 2 candidates with the most number of votes. Create a function to perform the announcement of winners based on votes percentage: void announceWinner(double candidatesVotesPercent[])
Answers
Answered by
7
Answer:
Similar questions