< previous page page_625 next page >

Page 625
        charList[counter] = ch;
        counter++;
        cin.get(ch);
    }
    length = counter;
}

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

void ZeroFreqList( /* out */ int freqList[],    // Zeroed list
                   /* in */  int length     )   // Length of list

// Zeros out the first "length" positions of freqList

// Precondition:
//     length <= MAX_LENGTH
// Postcondition:
//     All freqList[0..length-1] == 0

{
    int index;  // Loop control and index variable

    for (index = 0; index < length; index++)

            // Invariant (prior to test):
            //     freqList[0..index-1] == 0
            //  && 0 <= index <= length

        freqList[index] = 0;
}

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

void ScanList(
        /* in */  const char charList[],  // List of chars
        /* in */  int        length,      // Length of char list
        /* in */  char       inputChar,   // Character to be checked
        /* out */ int&       index,       // Index of match
        /* out */ Boolean&   found      ) // False if no match

// Searches charList for inputChar, returning the index
// in charList if inputChar was found

// Precondition:
//     length <= MAX_LENGTH
//  && charList[0..length-1] are assigned &&  inputChar is assigned

 
< previous page page_625 next page >