Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

cin.get();

Name: Anonymous 2009-03-18 13:24

I just started learning c++.
In the book I'm learning from it doesn't use
cin.get();
yet whenever i don't use it the program closes

am i doing something wrong or has the author not put it there for a reason?

Name: Anonymous 2009-03-18 13:30

>>1
maybe the author assumes your running it from the command line

Name: Anonymous 2009-03-18 13:31

>>2
i am running it from the command line

Name: Anonymous 2009-03-18 13:32

>>3
are you using windows?

Name: Anonymous 2009-03-18 13:33

>>4
yes

Name: Anonymous 2009-03-18 13:35

>>5
there's your problem!
In windows (if i remember correctly), it opens your programs in a different window. Without the cin.get(), it will close it straight away.

Name: Anonymous 2009-03-18 13:36

>>6
Ok thanks. I guess that solves the problem then.

Name: Anonymous 2009-03-18 14:34

Just using a command line prompt might be easier. Windows+r, cmd, then navigate to the program directory and run. Extra points if you use Cygwin instead.

Name: Anonymous 2009-03-18 16:41

>>1-9
I don't know you anymore /prog/.

You've CHANGED.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List