(ans=='y' || ans== 'Y')

Mar 1, 2009 at 3:41am
what does II do in this statement ?
Mar 1, 2009 at 3:49am
it's should be 2 vertical bars || and it means OR in C or C++ (it is a logical operator). The statement is true if ans equals 'y' or ans equals 'Y' (the user might type in lower or upper case) so allow both as yes answers.
Last edited on Mar 1, 2009 at 3:52am
Mar 1, 2009 at 3:54am
This is actually not the letter I. I forget the name of the character, but it is usually found on the keyboard near backspace. This is c++'s OR operator. In this case, if the user types either a capital Y, or a lowercase y, the program will accept both characters as an afirmation.
Mar 1, 2009 at 8:28pm
| is called a pipe.
Topic archived. No new replies allowed.