c++ force std::cout flush (print to screen)

Just insert std::flush:

std::cout << "Beginning computations..." << std::flush;

Also note that inserting std::endl will also flush after writing a newline.

Leave a Comment