< previous page page_689 next page >

Page 689
void BinSearch( const String10[], const String10, int, int&,
                Boolean& );
void CheckInStudents( const String10[], int, Boolean[] );
void GetClassRoster( String10[], int&, ifstream& );
void InitializeAttendance( Boolean[] );
void Insert ( String10[], int&, const String10 );
void OpenForInput( ifstream& );
void Print( const String10[], const Boolean[], int );
void ProcessName( const String10[], int, const String10,
                  Boolean[] );
void SearchOrd( String10[], const String10, int, int&, Boolean& );

int main()
{
    String10 student[MAX_LENGTH];      // Array of student names
    Boolean  isPresent[MAX_LENGTH];    // Array of 'check marks'
    int      length;                   // Number of students there
    ifstream roster;                   // Input file to be analyzed

    OpenForInput(roster);
    if ( !roster )
        return 1;

    InitializeAttendance(isPresent);
    GetClassRoster(student, length, roster);
    CheckInStudents(student, length, isPresent);
    Print(student, isPresent, length);
    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)

 
< previous page page_689 next page >