• Advertisement
Sign in to follow this  

stopping the window closing.

This topic is 4252 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

hi i think this website is great i am very new to programming and learning c++ using a book i got. i have created a small program where you enter your name and age, but as soon as you press enter after putting in your age, the rest of the infomation flashes and closes with out showing the rest of the program. any help on stopping the program closing untill you cross it off. thanks

Share this post


Link to post
Share on other sites
Advertisement
#include <iostream> and make a std::cin.get() call at the end of main(). This will cause the program to wait for Return to be pressed before the it continues.

Share this post


Link to post
Share on other sites
Quote:
any help on stopping the program closing untill you cross it off.


"cross it off"?

Share this post


Link to post
Share on other sites
you could also add a system("PAUSE")...

or press the red ! instead of the debug button... This puts a pause at the end but does not attach to the process.

Share this post


Link to post
Share on other sites
thanks
std::cin.get() doesnt work as when i press enter for the last bit of data it closes down,

by 'cross it of' i mean pressing the x in the top corner,

and the system("pause") works thanks
and i dont know what you mean by red !,

thanks for help

Share this post


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

  • Advertisement