Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Hi.
That's the problem with not specifying the operating system you are compiling under. My linux box had no problem with it.
Enjoy,
Christian
kc0arf
Posting Virtuoso
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57
there is an even better way to do that.
after you compile the program for the first time, find the exe it creates. Right click the exe, click properties, click the program tab, uncheck the box "close on exit". then click apply!
turning that off will leave the DOS window open until you close it. This is better because you can recompile the program and rerun the program from within the editor with out having to find the file every time :-p.
Your instructions don't apply to my Windows box (Windows XP Professional, SP1). Not only is there no "close on exit" box, there's no program tab in the properties menu of the executable. Any ideas?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
there is another way too. whenever you want the program to pause so the user can read what it says you can type in getch(); and it will pause the program until the user presses anykey. (usefull for when you wish to display multiple pages of information.)
for example:
#include <iostream.h>
#include <conio.h>
int main()
{
cout << "press any key to continue..." << endl;
getch();
return 0;
}
will pause the screen while saying press anykey to continue until the user presses anykey. (in this example the window would close after you press anykey.).
(p.s. sorry for the long explination of getch () (which you probobly knew of already) but i wanted to make sure you understood what i ment, i hate it when people would just say something like "use the getch command" lol)
evilsilver
Junior Poster in Training
84 posts since Feb 2005
Reputation Points: 10
Solved Threads: 1