I want to show "\n" in my program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want to show "\n" in my program

How I can do it?

25th Feb 2019, 7:39 PM
Леонид Чуприна
Леонид Чуприна - avatar
2 Answers
+ 4
Escape the backslash with another backslash: "\\n"
25th Feb 2019, 7:44 PM
Dennis
Dennis - avatar
+ 2
You can always use Raw string literals auto greeting = R"("Hello \n world")"; https://docs.microsoft.com/en-us/cpp/cpp/string-and-character-literals-cpp?view=vs-2017
25th Feb 2019, 10:14 PM
Druko
Druko - avatar