Monday, December 5, 2011

Lab 9 - election day

You are to complete exercise 7, p540, writing a program which contains four user-defined functions. One function reads in the data from the user; one sums the votes received by all candidates; one calculates the percentage of the total received by each individual candidate; and one displays a table of the final results.

These are the headers:

   void getData(string names[], int nums[])
   int totalVotes(int nums[])
   void calcPcts(int nums[],
      double fracs[], const int sum)
   void tallyHo(string names[],
      int nums[], double fracs[])


The data I used for my sample run below was:

Johnson   5000
Miller    4000
Duffy     6000
Robins    2500
Anthony   1800


Sample Output
Here is a screenshot of my code running.

Election Day output

Refer to the deliverables post for comment formatting and required program identification information.

Due Date:
Sunday, December 11th, 6:00pm