Boolean Expression in C++
Level 299 keystrokes
Stores the results of two comparisons in bool variables and combines them with &&; both are true, so 1 is printed.
C++ code
// Initializes x with 51int x = 5;// A comparison produces a bool: 5 > 0 is true2bool isPositive = x > 0;// 5 < 10 is also true3bool isSmall = x < 10;// true && true is true, which cout prints as 14cout << (isPositive && isSmall) << endl;Output
1
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C++ code and how often they appear.
<× 5;× 4=× 3&× 2(× 1)× 1>× 1