It sounds like the microsoft "console window". This is a window that appears when running MS programs that write output to "standard output" and have console mode enabled. The console window will remain on the screen for as long as your program continues to run. So what you are probably seeing is your program writing some text to "standard output" and then exiting. To keep the window around longer you need to keep your program running longer. There are two typical ways to do that. One is you could simply force your program to wait a while, using using a Sleep command (Sleep(milliseconds) or sleep(seconds)) or put in a busy loop. A busy loop simply runs up an integer doing nothing: for(n = 0;n < 100000000;n++); The other thing you could do is get some blocking input going, which sounds like what the book wants with "hit any key to continue". In C this would be something like c = fgetc(stdin) or fgets(buf, 255, stdin).
I am very happy to hear that you are actively seeking out new things to learn. I hope that C and C++ are to your liking. If you have already picked up Pascal, C should follow somewhat similarly. They are both really in the same family, though C is lower level and relies much more heavily on operators than does Pascal. The biggest differences might be that C is not as strict about structure and has pointers. C++, on the other hand, is quite different from Pascal in that it is nominally an "object orientated" language. It introduces classes, overides, templates, and much else that are not in straight procedural languages like C and Pascal.
It sounds like your book is headed towards Windows programming (in that it provides MS Visual C++). You may want to keep going in that direction, but it will be harder to help you in that MS does things very differently than a normal C/C++ compiler and does not rigorously stick with standards (not K&R, Stroustrup, ANSI, or POSIX). You might consider some of the free compilers available for Windows, such as Digital Mars C/C++. Or, use the C/C++ compiler that is the defacto standard on Linux: gcc and g++ - the gnu compiler. Using a command line driven compiler will eliminate the need to worry about Window's console window and other oddities only associated with MS programs and programming environments.
Even when we build Sesame on Windows, we don't use the Visual environment. We use the MS compiler from the command line. That allows us to write debug out to the command line window that invoked the program, without having the program opening its own "concole window". It also is, in my opinion, a more reasonable environment than MS's IDE. I'm not sure how comfortable you are with the command line in Windows or in Linux, but I much prefer to have multiple command line windows open, than to mess around with pulldowns and dialog boxes.
|