0

Anyone can explain me about that "\n\n " tag in this code:-

#include <iostream> using namespace std; int main() { int r; cout<<"press 0 if you want to exist\n\n"; while(1) { cout<<"enter any number:"<<endl; cin>>r; if(r==0){ cout<<"program exist"; break; } cout<<"You have entered:"<< r<<endl; } return 0; }

5th Aug 2019, 5:04 PM
Ravi Henry
Ravi Henry - avatar
2 Antworten
+ 6
\n is the escape character for a new line, and will essentially do the same thing as pressing enter on a keyboard while you're typing a document, for example, creating a new line for text to be printed on. In the code, what it's doing is printing out the string followed by 2 newline characters, making sure that the next text to be printed will appear 2 lines following the first string
5th Aug 2019, 5:08 PM
Faisal
Faisal - avatar
+ 1
Thx
6th Aug 2019, 1:13 AM
Ravi Henry
Ravi Henry - avatar