It closes because there's nothing telling it to stop after it finishes the last cout line. Simply place a system("PAUSE"); right before return 0; and after cout<<"You entered "<<thisisanumber;.
So it would be:
Code:
#include <iostream>
int main ()
{
int thisisanumber;
cout<<"Enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
system("PAUSE");
return 0;
}
You could also place a few endl's after the cout's to make it look more organized. For example:
Code:
cout<<"Enter a number:"<<endl;
So instead of running the program to show:
Enter a number: _
(the underscore is the little blinky thingamajig*
It would look like this with endl:
Enter a number:
_