< previous page page_690 next page >

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

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

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

void InitializeAttendance(
                /* out */ Boolean isPresent[] )   // Check mark list

// Initializes all components of the array isPresent to FALSE

// Postcondition:
//     isPresent [0..MAX_LENGTH-1] == FALSE

{
    int count;      // Loop control variable

    for (count = 0; count < MAX_LENGTH; count++)

            // Invariant (prior to test):
            //     isPresent[0..count-1] == FALSE
            //  && 0 <= count <= MAX_LENGTH

        isPresent[count] = FALSE;
}

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

void GetClassRoster(
             /* out */   String10  student[],    // List of students
             /* out */   int&  length,       // Length of list
             /* inout */ ifstream& roster    )   // Roster data file

// Reads the class roster from the data file

// Precondition:
//     The roster file has been successfully opened for input
//  && The no. of student names in the file <= MAX_LENGTH
// Postcondition:
//     length == number of student names in the file
//  && student[0..length-1] contain the student names read from
//     the file, truncated to 10 characters each

 
< previous page page_690 next page >