While Loop

How do I prompt the user to enter an integer from the range 50 to 100 and use a do while loop to repeat the prompt if the value inputed is outside of the rangw?


1
2
3
4
5
6
7
8
9
do
	{
	cout << "Enter an integer between 50 and 100. " << endl;
	cin >>a;


	}
	while ( 50< a < 100);
	
You need two conditions with an or clause:
 
while ( a < 50 || a > 100);



C++ does not recognize the kind of statement you are writing in your condition; try breaking up the condition into its component inequalities. Remember that a > b > c, when we are principally concerned with b is a > b and b > c.
Topic archived. No new replies allowed.