How come this won't work? variable = letter

1
2
3
4
5
do {
cout << "Does your hotel have a 13th floor? (Y or N)     ";
cin >> floor13;
   }
while (floor13 != Y || floor13 != y || floor13 != N || floor13 != n);



I want it to repeat if the user types something other than Y or N, but it gives me the error that I have to define Y y N and n.

This is for an assignment and I thought doing this would work, how can I fix it?
You have omitted quotes. Either single quotes if floor13 was declared as a char or double quotes if it was declared as a string.
Ok I added single quotes around each letter like this

while (floor13 != 'Y' || floor13 != 'y' || floor13 != 'N' || floor13 != 'n');

but now when I cin floor13 as Y y N or n it still loops as if I had entered something other than those choices, did I still type it out wrong?
Use && (logical and) instead of || (logical or).
Cool , got it working , thanks a bunch !
Topic archived. No new replies allowed.