Newline Character in C++

Level 121 keystrokes

Prints "Hi" and ends the line with the newline character '\n' instead of endl.

C++ code

// '\n' is a char literal for the newline character
// Unlike endl it does not flush the buffer, so it is usually the cheaper choice
1cout << "Hi" << '\n';

Output

Hi
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
  • '× 2
  • "× 2
  • ;× 1
  • \× 1

More C++ examples at level 1

← C++ typing practice