Jun 19, 2008 at 5:50pm UTC
I want to force myself into using the more "excepted" line advance.
Is there any advantage of one over the other? Maybe one used more in real world programing? One a old version one newer?
Could someone with a good amount of experience shed some light on this minor mystery? :)
Thanks in advance!
Jun 19, 2008 at 6:14pm UTC
There's only one difference:
cout << endl;
is the same as
cout << '\n' << flush;
Typically you don't want to flush at every output, but save it for the end. So if you are writing a lot of lines at once, use '\n'. Otherwise it doesn't really matter.
Hope this helps.
Jun 19, 2008 at 7:42pm UTC
Thanks Duoas, That is good information to know.