+ 1
Endl &/n
will it make a new single line if I put two ENDL'S?
5 odpowiedzi
+ 3
Each endl makes the cursor go to a new line. So two endl statements will produce an empty line.
+ 3
You mean like this:
cout<<"Hello World!<<endl<<endl; ? yes if you write it on row 1 your next output will be on row 3.
Same if you write it like this:
cout<<"Hello World! \n \n";
or like this:
cout<<"Hello World!\n<<endl;
+ 1
hi, if you put it in next line, it will work. but putting both of them next to other in a line, it does not work.
+ 1
yeah, it will create a new single line below the top line. The single endl is to move to the next line, another endl will function like an enter key on the keyboard. For using Endl and \n simultaneously, it will work only if you do it as thus:
cout << "Hello World! \n" << endl;
The \n must be inside the quote
0
Also /n is just the alternative to endl