Electrical and Computer Engineering
16 of 19
UAH
CPE 112
Implementation
•void WritePerCandidate(
•       /* in */    const VoteArray votes,       // Total votes
•       /* in */    const string    name[],      // Candidate names
•       /* inout */       ofstream& reportFile ) // Output file
•
•// Sums the votes per person and writes the totals to the
•// report file
•
•{
•    int precinct;       // Loop counter
•    int candidate;      // Loop counter
•    int total;          // Total votes for a candidate
•
•    for (candidate = 0; candidate < NUM_CANDIDATES; candidate++)
•    {
•        total = 0;