Check what you learned about else if, && and ||.
else if
&&
||
1. With age equal to 50, what does if (age > 10) { std::cout << "A"; } else if (age > 40) { std::cout << "B"; } else { std::cout << "C"; } print?
age
if (age > 10) { std::cout << "A"; } else if (age > 40) { std::cout << "B"; } else { std::cout << "C"; }
B
C
A
AB
2. With x equal to 10, what is x > 0 && x < 10?
x
x > 0 && x < 10
false
true
3. For which values of x is x < 0 || x > 100 true?
x < 0 || x > 100
150
-5
100
0
4. Which operator means "or"?
5. In a chain of if, else if and a final else, how many of the blocks run?
if
else
6. Which operator means "and"?