• ### Popular Now

• 13
• 16
• 19
• 27
• 9

#### Archived

This topic is now archived and is closed to further replies.

# Trouble with command prompt

This topic is 5243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am having trouble with a small program, a feet to meters converter program... The code is ok, except that after you input 3 values in meters, the length in feet shows up.. only problem is, the command prompt closes after that, thinking that everything is done... I am learning this project from the book "Game Programming All in One" and the images in the book show that his command prompt says "Press any key to continue" I copied his code EXACTLY, and have even used the cd in the book and it does the same thing. What can i do?

##### Share on other sites
Well, you could...

A: Run it from the command prompt rather than Windows Explorer.

B: Put System("PAUSE") at the end of your program and include Windows.h (not an option if you aren''t using windows, obviously).

C: cin >> to a temporary variable so that the user needs to enter in a value.

D: Use Microsoft Visual Studio if you''re a rich poser.

##### Share on other sites
A quick solution is too put a

system("pause");

at the end of your code. There are different ways to get this, but i''ve always considered that the quickest way.