When should <<endl be used ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

When should <<endl be used ?

I'm not familiar with coding at all, during the tutorial in c++ basics it shows this : cout<< x << endl; but than later doesnt continue to use endline. I know the tutorial is just examples for basic understanding but still brings me to the question, when should I be using it ?

25th Jul 2017, 4:21 PM
layna
layna - avatar
1 Answer
+ 3
When you want to flush the stream and start a new line. Otherwise use '\n' for just starting a new line, as it it much faster in terms of execution speed
25th Jul 2017, 4:36 PM
aklex
aklex - avatar