Hello everyone I am getting started in c++ and have been working on a class project. My issue is that I am trying to catch invalid responses and display an error message the informs user of the correct responses. here is what I have managed so far but it does not want to catch anything it seems.
do
{
//ask if customer is shipping a package.
//Affermative response enters Do/While loops Negative will open close program dialouge
cout << "\n\n\nAre you needing to ship a package today?";
cout << "\n\n\tPress 1) for Yes";
cout << "\n\n\tPress 2) for No";
cout << "\n\nEnter your selection here: ";
//Gets the user choice
if (!(cin >> type || type < YES || type > NO))
{
//Displays error if not a number
cout << "\n\nSorry that was not a valid entry.\nRemember 1 is for Yes and 2 is for No.";
cin.clear();
system("PAUSE");
cin.ignore(MAX_READ, '/n');
system("CLS");
}
if (!cin || type == NO)
{
return 0;
}
} while (type < YES || type > NO);