Flushing cout only affects when you see the output, not if you see it. Files are closed when a program ends, and buffers are flushed when a file is closed. Flushing won't make any difference in the (eventual) output display.
Flushing is useful in cases that don't apply to your test, such as:
1. Interactive command-line programs. When you output a prompt or a warning or other message, you want to make sure it reaches the user before the program goes on.
2. Real-time reports of what a program is doing. For example, debugging messages written to a log file should be flushed so that someone monitoring the log file (as the program is running) will have up-to-date information.
3. Crash-proofing. Until a buffer is flushed, the output it contains is suseptible to loss if the program (or system) crashes. Once it is flushed, it is up to the operating system to send it to its destination. In the case of a disk file, delayed writes (an optimization technique) can still leave it vulnerable, but journaling (a safety technique) can protect it. Crash-proofing your output is sometimes important, such as writing a message about an important action, i.e., a financial transaction completed.