Escape Quote in C++

Level 133 keystrokes

Prints He said "Hi", using \" to put double quotes inside a string literal.

C++ code

// A plain " would end the string, so \" is used for a literal double quote
// The output is He said "Hi" (the backslashes are not printed)
1cout << "He said \"Hi\"" << endl;

Output

He said "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
  • <× 4
  • \× 2
  • ;× 1

More C++ examples at level 1

← C++ typing practice