On Sat, 21 May 2005 06:00:26 UTC, "Eric Whittaker" <ew****@adelphia.net>
wrote:
hi all,
im trying to write my first c++ program. a success, but i can't get the
window to stay open after user enters input. it just automatically closes.
right now the end of my program looks like this:
return 0;
}
anyone know what i'm doing wrong?
thanks, eric
Eric,
We need a little more information to help you. What kind of
program are you writing? If the code is small enough perhaps
some of it could be posted.
You mention that the end of your program has the above
statement. I'm going to guess that you wrote a simple
"hello world" type program. Thatwould indicate to me
that the program was a console program or whatever your
operating system calls it. Anyway, if you're using a
windows based view by running the program by "clicking
on it from Explorer under Windows" and the program is
just a console application, that is the correct behavior.
Two things are happening. One is that your program is
running. Second, once the program has run the
automatically started console session closed. To change
this behavior, open a console session and use the
command line to move to and run your program. When the
program is done you will still have the console window
open so you can view the results.
If you are talking about the above line being the
end of your program and the program have a graphics
interface (window), the end of the program will end
the window. In that case you need to provide some
method to keep the program open for a while longer.
If all else fails, ask one more question with your
program -- "press enter to end program" and wait
for input.
David