The birds and the bees.
When I run my console application, the black window flashes a bit then closes automatically. How can I see the output of my program?
Your program does exactly what you tell it to do, and you didn't ask it to wait before closing. You can add a command to wait for keyboard input before the program exits (e.g. before the return from main). A very simple example is system("pause"); which executes the "pause" system command (portability note: this only works in Windows and DOS); you need to #include <cstdlib> (or #include <stdlib.h> for C programs) if the compiler complains about the system function. Or you can use an instruction that reads something from the keyboard (e.g. cin.get();, getchar(); or cin>>variable;). In that case you may need to clear the input buffer before reading, e.g. cin.sync(); before cin.get();. Another option is to run your program from the command prompt; this is especially useful if you don't want it to wait before closing, or if it crashes before it reaches the keyboard-reading instruction.