Flushing takes time. That's exactly why buffering was
invented. So, in C++, one flushes only when it is necessary.
Flushing ::std::cout immediately before a program ends
is not necessary.
And how else do you know that the output has correctly worked.
Every program I've ever written which outputs to std::cout
flushes the output immediately before finishing, and tests the
error status of std::cout after the flush, in order to output an
error message and return EXIT_FAILURE if the output hasn't
worked. I'd consider it an error is a program didn't do this.
With regards to the chose of std::endl or '\n', it depends. The
default choice is std::endl, so that output will appear, even if
the program later crashes (in which case, the final output is an
important hint as to where the problem lies). On the other
hand, if you're outputting a number of lines, with no
significant intermediate calculations, it's perfectly fine to
use '\n'. And of course, if the program does actually run to
slowly, you do what you have to do to speed it up. (But that
falls under the heading of optimization.)