Electrical and Computer Engineering
5 of 19
UAH
CPE 112
Write Totals per Precinct
(In: votes; Inout: reportFile)
•FOR each precinct
• Set total = 0
•
• // Compute row sum
• FOR each candidate
• Add votes[precinct][candidate] to
• total
• Write “Total votes for precinct”, precinct+1, ‘:’, total to reportFile