+ 2

With \n in the quotations how can you actually print “\n” without it creating a new line? C++

Sorry for the dumb question… just finished lesson 3 of C++ and am wondering if it’s possible to output the text “\n” and not create a new line. Would you need to join them separately or is there another way to tell your code to treat \n as a string and not a new line? And I apologize if this isn’t the right place to ask… the Q/A on this lesson isn’t active, and I need bits for the code coaches. 😊 this is also just a theoretical question. Thanks!

6th Dec 2021, 10:46 PM
Justin Whorl
Justin Whorl - avatar
1 Resposta
+ 3
For \n i have a simple ans cout<<"\\"<<"n"; cout<<"\\n"; also works
6th Dec 2021, 10:50 PM
‎میم شین‎