How do you output \ symbol using cout?
Since C++11 you can also use raw string literals.
std::cout << R"(There is no need to escape backslash here \)";
Escape characters (like \n \t or " ) are not processed in the raw string literals.
In addition to all the correct answers, see this for further escaped characters
\a Bell (beep)
\b Backspace
\f Formfeed
\n Newline
\r Return
\t Tab
\\ Backslash
\' Single quote
\" Double quote
\xdd Hexadecimal representation
\ddd Octal representation
\? Question mark ('?')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With