Electrical and Computer Engineering
6 of 19
UAH
CPE 112
Implementation
•//***************************************************************
•// Election program
•// This program reads votes represented by precinct number and
•// ballot position from a data file, calculates the sums per
•// precinct and per candidate, and writes all totals to an
•// output file
•//***************************************************************
•#include …
•
•using namespace std;
•
•const int NUM_PRECINCTS = 4;
•const int NUM_CANDIDATES = 4;
•
•typedef int VoteArray[NUM_PRECINCTS][NUM_CANDIDATES];
•                                 // 2-dimensional array type
•                                 //   for votes
•