Logical Not in C++

Level 123 keystrokes

Negates false with the ! operator and prints the result, true, as 1.

C++ code

// ! is the logical NOT operator: it turns true into false and false into true
// !false is true, which cout prints as 1
1cout << !false << 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
  • !× 1

More C++ examples at level 1

← C++ typing practice