Newline Escape in C++

Level 126 keystrokes

Prints "Hi" and "Bye" on two lines using the \n escape sequence.

C++ code

// \n inside the string starts a new line, so Bye appears below Hi
// Unlike endl, \n does not flush the output buffer
1cout << "Hi\nBye" << endl;

Output

Hi
Bye
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
  • ;× 1
  • \× 1

More C++ examples at level 1

← C++ typing practice