I think that you mean that your DOS terminal closes as soon as your program ends.
A common solution is to call cin , scanf or getch at the end of your program immediately before your return 0 . This makes the program wait for any user to enter before exiting.
It is best to compile your program and then run it from the DOS prompt. Just run the DOS prompt, cd in the directory your program is in and run it from there.
source share