Trying to catch invalid repsonses

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);


Any advice would be greatly appreciated.
!(cin >> type || type < YES || type > NO)You probably misplaced bracket here.
Correct condition: !(cin >> type) || type < YES || type > NO
Thanks I was sure it was something simple I was not seeing and you were right misplaced parenthesis do make the a lot of difference.
Topic archived. No new replies allowed.