< previous page page_755 next page >

Page 755
    nearestTen = int(percent / 10.0 + 0.5);
    for (counter = 9; counter >= nearestTen; counter--)
        barChart[counter] [day] =  ;
    for (counter = nearestTen - 1; counter >= 0; counter--)
        barChart [counter] [day] = *;;
}

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

void WriteBarChart(
  /* in */    const ChartType barChart,      // Chart of percentages
  /* inout */ ofstream&       reportFile )   // Output file

// Writes the bar chart to the report file

// Precondition:
//     barChart[0..9] [MONDAY..FRIDAY] are assigned
// Postcondition:
//     barChart has been output to the report file with
//     appropriate headings

{
    int     counter;    // Loop counter
    DayType day;        // Loop counter

    reportFile << endl
               << setw(42) << BAR CHART:  ABSENCES BY DAY << endl
               << setw(11) << Monday << setw(11) << Tuesday
               << setw(11) << Wednesday << setw(11) << Thursday
               << setw(11) << Friday << endl;

    for (counter = 9; counter >>= 0; counter--)
    {
        reportFile << setw(2) << counter + 1 << 0%;
        for (day = MONDAY; day <= FRIDAY; day = DayType (day + 1))
            reportFile <<     << barChart [counter] [day]
                       <<        ;
        reportFile << endl;
    }
}

 
< previous page page_755 next page >