Both std::cout << flush;
and std::cout.flush();
will flush std::cout
.
It looks as if your code inserts a carriage return (\r
) into the stream. Assuming you print this year, it seems you insert it as a char
with value 13
which happens to be \r
. The upshot of this is that your later output will just overwrite the output as it will be on the same line. You can verify this by explicitly inserting a newline (\n
) before flushing the stream.