Possible Duplicate:
C++: “std::endl” vs “\n”
I have a simple program I tested and I realise that endl
wreaks havoc on my program. Using endl, my program ran in 100+ ms while working with '\n'
, the time dropped to ~50ms.
Can anyone tell why is there such a difference?
P.S. I did read other posts that somehow explained what each of them are doing, but does std::flush
really take so much time?
Or could there be another possible explanation?