• Advertisement
Sign in to follow this  

need help on exercise in C++ book

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just bought Beginning C++ Game programming by michael dawson and im on the exercise "lost fortune". I wrote the code and it runs fine,but after it asks for my last name and i press enter it just exits. Why does it exit? please help.

Share this post


Link to post
Share on other sites
Advertisement
Well, why don't you post your code and we'll see if we can help you. Please use the "source" and "/source" tags (in square brackets) to make it tidy.

-fel

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It probably exits because the application finishes running. If you want to see the final output, you should run it in a console window, or add some code that will delay application exit.

Share this post


Link to post
Share on other sites
Quick fix to run it and not have to change any code.

1) Click START->Run
2) Type cmd and hit enter
3) now go to the directory you have your compiled applicaion in and run it from there, that way it won't exit.


You can also do it in code using system("pause") or a getch or whatever :) That way you won't have to drop to a DOS box.

Share this post


Link to post
Share on other sites
This is cross-posted.

The code posted there has a little cin.ignore trick at the end that *should* pause the program as far as I can tell... :/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement