+ 2

How can I explicitly show '\n' instead of using it to end line?

For example if I make a code where I use the '\n', such as:{ cout << "to end a line use \n"}, how can I make '\n' appear without it being interpreted by the computer to end line and instead show up on the display box?

17th Jul 2016, 6:21 AM
ChatGabGossip
5 Réponses
+ 4
use double backslash \\n
17th Jul 2016, 6:27 AM
Karan Luther
Karan Luther - avatar
+ 2
#include <iostream> using namespace std; int main() { cout<<"\\n"; return 0; }
17th Jul 2016, 7:20 AM
Vishal Koshti
Vishal Koshti - avatar
+ 2
\\n simple... ;)
17th Jul 2016, 8:52 AM
Aalap Patel
Aalap Patel - avatar
+ 2
cout <<"\" <<"n"; or cout <<"\\n";
17th Jul 2016, 3:51 PM
Mayur Gadhiya
Mayur Gadhiya - avatar
+ 1
use double backslash \\n
17th Jul 2016, 8:17 AM
josh