Boolean Output in C++

Level 121 keystrokes

Prints the bool value true, which cout shows as 1 by default.

C++ code

// true and false are the two bool literals in C++
// By default cout prints true as 1 and false as 0 (use boolalpha to print the words)
1cout << true << endl;

Output

1
Practice typing this code

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.

  • <× 4
  • ;× 1

More C++ examples at level 1

← C++ typing practice