Re: [Dev-C++] why does window close after execution? newbie
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: <or...@vp...> - 2003-08-01 11:31:43
|
Graham wrote: > I have installed Dev-C under Win XP Pro > and am running the traditional "Hello World" as the first exercise in my > tutorial. > When it is compiled and run it instantly closes the window after > printing to the screen. I therefore cant see the output. > Is there a way to change this with a setting of DEV-C or will I have to > put up with adding some sort of pause statement at the end of everything > I write? > > my code looks like this > /* > *Hello, "Hello World.\n" > */ > #include <iostream> > int main () > { > cout<<"Hello, world.\n"; > return 0; > } This is indeed a VVVVVFAQ (very-very-very-very-...). BTW this is absolutely NORMAL behaviour. To make the dos-prompt stay, you need to pause your program at the end. Use this line before return: getc(); This will wait for an "Enter". (I don't like system("PAUSE"), as that is platform-dependent). -- Greetings, Balázs |