need help on exercise in C++ book
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.
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
-fel
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.
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.
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.
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... :/
The code posted there has a little cin.ignore trick at the end that *should* pause the program as far as I can tell... :/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement