Hi, I'm new to C++. Anyway, what's the point of using endl when you can use \n?
Printable View
Hi, I'm new to C++. Anyway, what's the point of using endl when you can use \n?
run a search.
click here your search is done for you.
That raises some new questions: what's the point of typing std::cout instead of cout?
Also, what does "flushes the output buffer" mean?
>Also, what does "flushes the output buffer" mean?
Flushing the output buffer empties the buffer onto the screen.
>>what's the point of typing std::cout instead of cout?
http://faq.cprogramming.com/cgi-bin/...&id=1043284351
>>what does "flushes the output buffer" mean?
Output from your program can sometimes be buffered before it is actually displayed on the screen, or written to the file (depending on where it's going). Using a flush routine tells the OS to move the data from the buffer to its destination now, rather than letting the OS decide when to do it for you.
Yeah, I've had information displayed in the wrong sequence, or even wait until main() ends before it was displayed. This was when using \n in a windows console application.Quote:
now, rather than letting the OS decide when to do it for you.