+ 5
How to print \n in cout?
how print "" also?
7 Antworten
+ 10
cout<<"\n"; // new line
cout<<"\\n"; // prints \n
cout<<"\"\""; // prints ""
Btw, \ is the escape character, which lets you prevent the functions that the characters normally represent so you can print them instead.
+ 1
No. Actually @Shubham do not ask to do line break. However, he ask how to print \n in the console
0
You can even use endl for a next line.
0
Cout << “whatever you wish to print”<< endl;
0
\n is one of the escape characters in C++ programming language and you can also use endl for a new line and when you use \n it should be in the ""
0
Just writing cout<< “\n “ ;
0
it cannot be printed as the output it is used only to escape or for the new line