< previous page page_749 next page >

Page 749
    GetData(absenteeData, dataFile);
    ComputeAverages(absenteeData, average);
    WriteTable(absenteeData, average, reportFile);
    Summarize(absenteeData, barChart);
    WriteBarChart(barChart, reportFile);
    return 0;
}

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

void OpenForInput( /* inout */ ifstream& someFile )    // File to be
                                                       // opened
// Prompts the user for the name of an input file
// and attempts to open the file

// Postcondition:
//     The user has been prompted for a file name
//  && IF the file could not be opened
//         An error message has been printed
// Note:
//     Upon return from this function, the caller must test
//     the stream state to see if the file was successfully opened

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

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

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

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

void OpenForOutput( /* inout */ ofstream& someFile )   // File to be
                                                       // opened
// Prompts the user for the name of an output file
// and attempts to open the file

// Postcondition:
//     The user has been prompted for a file name
//  && IF the file could not be opened
//         An error message has been printed
// Note:
//     Upon return from this function, the caller must test
//     the stream state to see if the file was successfully opened

 
< previous page page_749 next page >