On 29 mar, 05:48, andrew.smith....@gmail.com wrote:
whts the difference between the std::endl or "\n" ?
because both do the same work
std::endl flushes the buffer, "\n" doesn't. If you don't know
what you're doing, and don't want to think about it, use
std::endl. It will make debugging a lot easier. If you're
outputting a lot of short lines in a sequence, however, you
probably want to use "\n", since flushing can be a fairly
expensive proposition. (My general rule is to use "\n" in loops
or short sequences of code, but to make sure that there is an
std::endl or an explicit call to flush at the end of the
function or after the loop.)
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34