How to shut down the console window of a c++ program without waiting for the key stroke after showing results in console window

How to terminate a c++ program after showing the results in console window.Do not wait for the key stroke.
Last edited on
The program will terminate automatically when you return from the main function.
You mean I don't need to anything particular to make it happen.Just return 0 at the end of the main function will be good?
I mean in Windows OS,when the results show up in the console window,the program waits for the key stroke to show down the console window.

Is this the case?If so,how to shut it down immediately after the program finished.Do not wait for the key stroke.

I want to know what's the case in Windows OS,because I am a Mac user.
Last edited on
Just as on a Mac, it's not your business to decide what the user wants. If the OS had to open a console window to run your program, it will close it when your program terminates. If the user opened a console window and started your program from it, he'll be totally ticked off of your program closes it.

Hope this helps.
The wait thing might be something that your IDE is doing. Try run your program outside the IDE and see if there is a difference.
Topic archived. No new replies allowed.