Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any other way than cin.get( ) ???

Status
Not open for further replies.

pauiel

Programmer
Jan 19, 2004
17
0
0
US
I'm just beginning C++, so don't get mad at me if the answer is obvious :)

I would like to know if there is another way to keep a program going (possibly until a certain key is hit) than using a cin.get() command. Any solutions? -Daniel
 
Some ideas that are not portable are system("pause") and getch().
 
getch() won't work as the compiler will say "implicit declaration of function 'int getch(...)'". I've been using getchar(). This works most of the time, but no guarantees that a pause will always be (en)forced. And system("PAUSE") is a DOS command that will do the job, unless you're looking for no further output shown, but will show "Press any key to continue...". Anybody else have any more ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top