This is my assigment and i have no idea to do that. Somebody please help !
Write a program that reads from a file the number of candidates in a local election,
then their last names and the number of votes received by each.
Use dynamic memory allocation to store the information in one or more arrays.
The program will then output each candidate’s name, the number of votes received,
and the percentage (use 2 decimals of precision) of the total votes received by the candidate.
(The total of percentages may not add up to 100 because of rounding errors)
Use a minimum of 2 functions (in addition to main).
At least one of those functions must pass an array and its size as parameters.
Your program will also output the winner of the election.
A sample file is:
5
Johnson 5000
Miller 4000
Duffy 6000
Robinson 2500
Ashtony 1800
The sample output for that data 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.