+ 1
Is there a benefit from endl or /n
what's the difference between the two because they do the same thing?
3 Answers
+ 1
from what I've just read on stack the endl manipulator flushes the stream buffer, the \n doesn't.
+ 6
using "\n" in your string makes it weird. so endl just prints another "\n" for you without making it weird.
+ 6
usage of "\n" :
cout << "some string\n";
// (weird string / annoying)
usage of endl :
cout << "some string" << endl;
// (better and clean)