-
A simple question
hello
I'm new to C++, and I've looked at some of the examples found on the cprogrammings tutorials. I have no problem understanding what they do(and have no problems with the codes in itself), but after i compiled it, i dont reach reading the last answer/message I get, cause it dissapear really fast. Do anyone know how to make the last messages, replies, last for a while so it is possible to read it?
Answer would be appreciated:)
Thanks
Hansteen
-
Have the program wait for user input at the end of the program, that way it won't close until the user types something.
Code:
#include <cstdio>
int main ( void )
{
// Do stuff
getchar();
return 0;
}
-Prelude
-
Well I guess this is the easiest way I can think of.......
Code:
#include <iostream.h>
int main()
{
cout<<"Type a letter and the press Enter to exit"<<endl;
int exit;
cin>>exit;//this will pause until something is typed.
return 0;
}