Electrical and Computer Engineering
14 of 19
UAH
CPE 112
Implementation
•void WriteReport(
•       /*in*/    const VoteArray votes,      // Total votes
•       /*in*/    const string    name[],     // Candidate names
•       /*inout*/       ofstream& reportFile )   // Output file
•
•// Writes the vote totals in tabular form to the report file
•{
•    int precinct;       // Loop counter
•    int candidate;      // Loop counter
•
•    // Set up headings
•
•    reportFile << "            ";
•    for (candidate = 0; candidate < NUM_CANDIDATES; candidate++)
•        reportFile << setw(12) << name[candidate];
•    reportFile << endl;