I mean...where is the tutorial on how to use a function, while loop, and if and statement to output a different message (1 or 2) and should the user enter anything differenet than 1 or 2 ask them to enter again
Printable View
I mean...where is the tutorial on how to use a function, while loop, and if and statement to output a different message (1 or 2) and should the user enter anything differenet than 1 or 2 ask them to enter again
It's all here
jeez man-where do u think i learned how to write what i have written-ive been reading that thing all day-it doesnt say how to do this
In fact, this code IS derived from the tutorials you are telling me to read-Im trying to add onto the tutorial by making it so u cant enter a non-integer and have it try to use that non-integer-the examples there have the same problem this thing has
Code:char x='0';
cout<<"Please choose a room (1 or 2): ";
while (x!='1' && x!='2')
cin>>x;
if (x=='1')
// do room 1 stuff
if (x=='2')
// do room 2 stuff