< previous page page_750 next page >

Page 750
{
    char fileName[51];   // User-specified file name (max. 50 chars)

    cout << Output file name: ;
    cin.get(fileName, 51);
    cin.ignore(100, \n);

    someFile.open(fileName);
    if ( !someFile )
        cout << ** Can't open  << fileName <<  ** << endl;
}

//******************************************************************
void GetData(
         /* out */   TableType absenteeData,    // Table of absences
         /* inout */ ifstream& dataFile     )   // Input data file

// Reads the absentee data from the data file

// Precondition:
//     File dataFile has been successfully opened for input
//  && The file contains 5 * NUM_DEPTS integer values, arranged
//     in column order (all absences for Monday, then all absences
//     for Tuesday, etc.)
// Postcondition:
//     absenteeData[A..F][MONDAY..FRIDAY] contain the input values

{
    DayType  day;       // Loop counter
    DeptType dept;      // Loop counter

    for (day = MONDAY; day <= FRIDAY; day = DayType (day +1))
        for (dept = A; dept <= F; dept = DeptType(dept + 1))
            dataFile >> absenteeData[dept][day];
}

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

void ComputeAverages(
     /* in */  const TableType absenteeData,    // Table of absences
     /* out */ float           average[]    )   // Average per dept.

// Calculates averages across the rows of absenteeData

 
< previous page page_750 next page >