Hello, I am a total beginner at c++
- Dev C++ How To Stop Program Console From Closing Date
- Dev C++ How To Stop Program Console From Closing 2017
- Dev C++ How To Stop Program Console From Closing Without
I am writing a console program and I am wondering how I should do to exit the
program, like if the user is asked
Aug 09, 2005 Preventing the console window from closing when writing a console program in C. C / C Forums on Bytes. Home topics c / c questions preventing the console window from closing when writing a console program in c. // function to prevent the Dev C Console Window from closing // before I can see the program's output void. The console is not part of your program. If you have a console, and you start your program within that console, when your program finishes, that console will still be there. It sounds to me like you're not starting the console, though; I expect your IDE is starting it for you, and then closing it for you afterwards.

Do you want to continue ( yes/no) and the user enters no then I want the console
to shut down...
- 6 Contributors
- forum 14 Replies
- 5,229 Views
- 1 Day Discussion Span
- commentLatest Postby murnestyLatest Post
Moschops683
Within main, finish the program with return 0;
std::string isShutdown;

std::cout << 'Shutdown? Y/N' << std::endl;
std::cin >> isShutdown;
if (isShutdown 'Y')
{ return 0;}
Dev C++ How To Stop Program Console From Closing Date
You can also end a program by using abort() and exit(), but they place additional responsibilities on the conscientious programmer. Using return is the standard way.
Dev C++ How To Stop Program Console From Closing 2017
