Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

When compiling c++ (hello world) the command prompt, immediately shuts down. How can i stop this?

5 Answers

Relevance
  • 2 decades ago
    Favorite Answer

    when processing any routine, be it .bat, .exe, .com the CMD is invoked, (C++, Perl, etc..) after execution, the code finishes, then closes the command prompt window since it was not run natively. To avoid this, first open a command prompt window and run your code from there :)

    Source(s): Perl: How to Program (BOOK) http://www.rsccd.org/homex.asp
  • 2 decades ago

    Can you provide more details? Do you get any error messages? What compiler are you using? And what OS and command line terminal?

  • 2 decades ago

    try running the command line first by typing cmd in the run box in the start menu then try to run your program for it.

  • 2 decades ago

    An easy way to do this is making your program waiting for input,that is using

    cin>> i;

    as last line of your program. ( Here i must be declared earlier)

  • How do you think about the answers? You can sign in to vote the answer.
  • Anonymous
    4 years ago

    everywhere you position your source record, cd to that director. make sure c:mingw is on your %route% variable and form gcc -o software software.c or g++ -o software software.cpp. it truly is all you should do. You convey jointly from whichever listing your source record is in.

Still have questions? Get your answers by asking now.