< previous page page_737 next page >

Page 737
{
    int precinct;        // Loop counter
    int candidate;       // Loop counter

    // Set up headings

    reportFile <<             ;
    for (candidate = 0; candidate < NUM_CANDIDATES; candidate++)

            // Invariant (prior to test):
            //     name[0..candidate-1] have been output
            //  &&  0 <= candidate <= NUM_CANDIDATES

        reportFile << setw(12) << name[candidate];
    reportFile << endl;

    // Print table by row

    for (precinct = 0; precinct < NUM_PRECINCTS; precinct++)
{
            // Invariant (prior to test):
            //     votes[0..precinct-1][0..NUM_CANDIDATES-1] have
            //     been output
            //  && 0 <= precinct <= NUM_PRECINCTS

        reportFile << Precinct << setw(4) << precinct + 1;
        for (candidate = 0; candidate < NUM_CANDIDATES; candidate++)

                // Invariant (prior to test):
                //     votes[precinct][0..candidate-1] have
                //     been output
                //  && 0 <= candidate <= NUM_CANDIDATES
            reportFile << setw(12) << votes[precinct][candidate];
        reportFile << endl;
    }
    reportFile << endl;
}

//******************************************************************

 
< previous page page_737 next page >