BabyDaisy 89 75 93 53 76 Smiley 86 46 100 Nancy 97Write a complete program that reads student scores from stdin, and that outputs the student's name and the student's average score. For example, for the above file your program should output:
BabyDaisy 77.20 Smiley 77.33 Nancy 97.00Constraints
4 3 1 2 5
indicates that candidate 2 (using 0-based indexing) is the voter's preferred
candidate. For each candidate, your function should count the number of ballots
for which that candidate is the preferred candidate and assign the
tallies to the candidates vector. Your function should return the
number of the winning candidate. If there is a tie, return the candidate
with the lowest index. When the function returns, the calling function
should be able to examine the tallies in the candidates vector.
As an example, suppose the 2D candidates vector is:
3 1 2 1 2 3 3 2 1 1 2 3 2 3 1Then the candidates vector on return would be:
2 1 2and the winning candidate would be 0, because there is a tie and 0 is the lower index.
Constraints: