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

what does II do in this statement ?
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
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.
| is called a pipe.
Topic archived. No new replies allowed.