Nested If in C++
Level 270 keystrokes
Uses an if inside another if to check that x (15) is greater than 10 and less than 20; both hold, so Between is printed.
C++ code
// Initializes x with 151int x = 15;// Outer check: 15 > 10 is true, so the inner code runs2if (x > 10) { // Inner check, reached only if the outer one passed: 15 < 20 is true3 if (x < 20) { // Both conditions hold, so Between is printed4 cout << "Between" << endl;5 }6}Output
Between
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;× 2"× 2(× 2)× 2{× 2}× 2=× 1>× 1