Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 135,944 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,741 people online right now. Registration is fast and FREE... Join Now!




Program Won't Stay Open

 
Reply to this topicStart new topic

Program Won't Stay Open

TentativeChaos
10 May, 2008 - 05:24 PM
Post #1

New D.I.C Head
*

Joined: 10 May, 2008
Posts: 24


My Contributions
OK, so I'm doing a tutorial, trying to do really simple stuff, eg: Hello World! The thing is when I run my newly created program, it opens and displays the proper output in the black command prompt window thing, but then it disapears so fast I can't even read it. It appears for a fraction of a second then disappears. How do I fix that?
User is offlineProfile CardPM
+Quote Post

Cerolobo
RE: Program Won't Stay Open
10 May, 2008 - 05:26 PM
Post #2

D.I.C Regular
Group Icon

Joined: 5 Apr, 2008
Posts: 440



Thanked: 31 times
My Contributions
It's a sticky... At the top...

http://www.dreamincode.net/forums/showtopic30581.htm
User is offlineProfile CardPM
+Quote Post

TentativeChaos
RE: Program Won't Stay Open
10 May, 2008 - 05:29 PM
Post #3

New D.I.C Head
*

Joined: 10 May, 2008
Posts: 24


My Contributions
QUOTE(Cerolobo @ 10 May, 2008 - 06:26 PM) *


oops, my bad.
User is offlineProfile CardPM
+Quote Post

Delta_Echo
RE: Program Won't Stay Open
10 May, 2008 - 07:06 PM
Post #4

D.I.C Regular
***

Joined: 24 Oct, 2007
Posts: 439


My Contributions
At the end of the code place this function:
CODE

cin.get();


That will make the program wait for you to press enter.
Or, if your running windows:
CODE

system("PAUSE");


That sends the command prompt (cmd.exe) the command to wait.

Good luck
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 08:47AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month