The program is closing as soon as it's execution is complete. In this case when you return 0;
. This is expected functionality. If you want to see the output then either run it in a terminal manually or set a wait at the end of the program so that it will stay open for a few seconds ( using the threading library ).