954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pause

New boy -easy question - doing a tutorial and the compile and run work but the only time I see the program partially running is when I put in a cin - I have looked but I cannot find how to put in a pause and allow me to see the program on the screen - presently it just goes too fast to see the output.
Thanks

AllenN
Newbie Poster
4 posts since Dec 2004
Reputation Points: 10
Solved Threads: 0
 

Look here and here .

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

IT DEPENDS UPON WHICH C++ U R USING
IF U R USING TURBO C++ THEN THE
getch();
COMMAND WOULD HELP U TO HOLD THE SCREEN TILL U PRESS A KEY

FOR DEV C++ I THINK IT IS
system("pause")
but i`m not sure about it
try it.
good luck

varunrathi
Light Poster
41 posts since Aug 2004
Reputation Points: 10
Solved Threads: 1
 

for C

getchar(): // wait, not totally portable

for C++

cin.get(); // wait

Caveat, if a lose return is floating about, like after an input you might have to double line it.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 
getchar(): // wait, not totally portable

What is not portable aboutgetchar?

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 
What is not portable about getchar?


Sorry Dave,
I am getting old. Got it confused with getch(). The C function getchar() should be totally portable.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You