Why should we use endl here?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why should we use endl here??

endl is used to a newline to print second text .... we can see in the last program int x = 11; x++; cout << x; //Outputs 12 here we didn't use endl....but why did we use endl in this program?? int x=11; x++; cout<<x<<endl;

28th Dec 2017, 7:02 PM
Divyashree K.N
Divyashree K.N - avatar
4 Answers
+ 2
endl just causes the program to print on the next line.in situations 2,anything you cout next will be on another line
28th Dec 2017, 7:12 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 2
Actually, it means end line the reason it's to put a space between lines You can use \n
29th Dec 2017, 4:51 AM
María José
María José - avatar
+ 1
in program2 what should print in next line ??
28th Dec 2017, 7:18 PM
Divyashree K.N
Divyashree K.N - avatar
+ 1
thank you
28th Dec 2017, 7:24 PM
Divyashree K.N
Divyashree K.N - avatar