try two things:
firstly, when you compile a c / c++ program, include getch(); at the end of your program, that will prevent the executable file of that program from closing automatically.
secondly, right click on an executable file and go to its properties,
click on the Program tab and uncheck...