< previous page page_949 next page >

Page 949
//  && length == 0

{
    length = 0;
}

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

void TimeCardList::ReadAll( /* inout */ ifstream& inFile )

// Precondition:
//     inFile has been opened for input
// Postcondition:
//     list[0..length-1] contain employee time cards as read
//     from inFile
//  && 0 <= length <= MAX_LENGTH
//  && IF inFile contains more than MAX_LENGTH time cards
//         Warning message is printed and excess time cards
//         are ignored

{
    long idNum;      // Employee ID number
    int  hours;      // Employee punch-in time
    int  minutes;
    int  seconds;

    inFile >> idNum >> hours >> minutes >> seconds;
    while (inFile && length < MAX_LENGTH)
    {
            // Invariant (prior to test):
            //     list[0..length-1] contain the
            //     first length time cards from inFile
            //  && 0 <= length <= MAX_LENGTH

        list[length].SetID(idNum);
        list[length].Punch(hours, minutes, seconds);
        length++;
        inFile >> idNum >> hours >> minutes >> seconds;
    }
    if (inFile)
        // Assert: inFile is not at end-of-file
        cout << More than  < MAX_LENGTH <  time cards 
             < in input file.  Remainder are ignored. < endl;
}

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

 
< previous page page_949 next page >