Dev C++ How To Stop Program Console From Closing

Hello, I am a total beginner at c++

  1. Dev C++ How To Stop Program Console From Closing Date
  2. Dev C++ How To Stop Program Console From Closing 2017
  3. 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.

Dev c++ how to stop program console from closing time

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;

Dev c++ how to stop program console from closing date

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

Stop

Dev C++ How To Stop Program Console From Closing Without

Edited by Moschops: n/a