Code:
cout << "Please select from the following:\n\n"
<< "1. Add Customer\n"
<< "2. Delete Customer\n"
<< "3. Change Customer Name\n"
<< "4. Rent Video\n"
<< "5. Return Video\n"
<< "6. Renew Video\n"
<< "7. Report Overdue Videos\n"
<< "8. Report Checked Out Videos\n"
<< "9. Search for Customer\n";
while ( cout << "\nEnter your selection: " && !(cin >> selection)
&& selection>=1 && selection <=9 )
{
cout<< "Bad selection!";
cin.clear();
cin.ignore(std::numeric_limits < int >::max(), '\n');
}
is another option from the FAQ