Try using getch() function before the return statement of the main function and you should see the window not disappear until you press any key. getch() is defined in conio.h file and so may need to include the header file as well.