chris200x9 said:
ok I'm just learning c++ this question might be really simple but how do I get a program not to stay up untill i press escape, etc right now it just runs for a split second and outputs everything i programmed real quick then it disapears
oh yea btw im on windows
I'm assuming this is a console app, right? And I'm assuming you use Visual Studio? If so, this might help:
I know this is the way things work under VS .NET 2003:
* When you run the app without the debugger (Ctrl-F5 or Menu->Debug->Start Without Debugging) it will automatically stop, with the console window still visible, with the prompt "Press any key to continue." I think this is what you want. However, if you want to use the debugger...
* When you run through the debugger (F5 or Menu->Debug->Start), console apps run through, and disapper, like you say. You can put a breakpoint at the end of your program to pause things (for example, put your cursor on the "return" line at the end of your main function and press F9 to place a breakpoint). When you run the app through the debugger, it will stop at the breakpoint, giving you a chance to look at things.
* In any case (this should work for other environments) you could just call getchar() just before the return line at the end of your main function (or where ever you want to stick a pause in). The only downside is, you need to hit the enter key to move on (I don't think Esc or other keys will work). You may need to put #include <stdio.h> at the top of your source file in order to have access to getchar(). There are other ways to do this type of thing, but this is very easy.
BTW, Don't take this the wrong way, buy why are you posting a Windows programming question on Mac Rumors?