question concerning cin.ignore
consider the following block:
------------------------------------------------------------------
if(new_rec_ptr != NULL) // If no error allocating memory, get data
{ // and insert node.
// Get name and phone number from the user.
cin.ignore(80,'\n');
cout << "\nEnter a new record.\n";
cout << "Last Name: ";
getline(cin,new_rec_ptr->last_name);
cout << "First Name: ";
getline(cin,new_rec_ptr->first_name);
cout << "Phone Number: ";
getline(cin,new_rec_ptr->phone_num);
insert_node(new_rec_ptr);
}
------------------------------------------------------------------
i have not seen the cin.ignore before... what does this line do?
|