Possible Duplicate:
How to stop C++ console application from exiting immediately?
I am trying to see my results, what do I do to my code so I can see if what I did is correct?
#include <iostream>
using namespace std;
int main()
{
cout << "C++" << endl;
cout << "The sum of 11 + 12 = " << 30/2 << endl;
return 0;
}
I think what you mean is that your DOS terminal closes as soon as your program ends.
A common solution is to have a call to
cin,scanforgetchat the end of your program, just before yourreturn 0. This forces the program to wait for some user input before exiting.A better way is to compile your program and then run it from within a DOS prompt yourself. Just start up a DOS prompt,
cdto the directory your program is in and run it from there.