Hi! When i try to see how work the ready programms from book, it is compile, run, and closes window right away. How stopped prog after it finished to see and analyse all? Thanks a lot. I have Vista, Dev C++ 4.9.9.2

Recommended Answers

All 2 Replies

At the end of your example before the end of the return 0; put std::cin.get();

This will have the program wait for keyboard input from you before it is terminated.

So for example you have your Example.cpp file like this:

int main()
{

//blah blah
std::cin.get();
return 0;
}
commented: Props for not suggesting getch, system("PAUSE"), or some other equally horrible solution. +18

thank u very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.