< previous page page_805 next page >

Page 805
void GetName( /* out */ EntryType& entry )  // Struct receiving name

// Inputs friend's first and last name, storing them into entry

// Postcondition:
//     User has been prompted for a friend's first name and
//     last name
//  && entry.firstName == the input string for first name
//  && entry.lastName == the input string for last name

{
    cout << Enter person's first name. << endl;
    cin. get (entry. firstName, 16);
    cin.ignore(100, \n)

    cout << Enter person's last name. << endl;
    cin.get(entry.lastName, 16);
    cin.ignore(100, \n);

}

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

void GetPhoneNumber(
             /* inout */ EntryType& entry )  // Struct receiving number

// Inputs area code and phone number, storing them into entry

// Postcondition:
//     User has been prompted for the area code and phone number
//  && entry.areaCode == the input integer for the area code
//  && entry.phoneNumber == the input string for the phone number

{
    cout << Enter area code, blank, and the number
         <<  (including -). << endl;
    cin >> entry.areaCode;
    cin.ignore(1,  );                         // Consume blank
    cin.get(entry.phoneNumber, 9);
    cin.ignore(100, \n);
}

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

void Insert( /* inout */ EntryType list[],    // List to be changed
             /* inout */ int&      length,    // Length of list
             /* in */    EntryType item   )   // Item to be inserted

 
< previous page page_805 next page >