i combined most of the example codes and made one that works and doesn't just turn off immediately. However, i made a new file and it turns off as soon as it runs. everything is pretty much the same though..i don't know what i'm doing wrong. this is the code for the program that stays up until i'm finished with it:
Code:
#include <iostream>
using namespace std;
int main()
{
int thisisanumber;
int a;
int age;
a = 4 * 5;
cout<<"Answer is: " << a <<endl;
cout<<"HEY, you, I'm alive! Oh, and Hello World!" <<endl;
cout<<"Enter a number: "<<endl;
cin>> thisisanumber;
cin.ignore();
cout<<"You entered: "<< thisisanumber << endl;
cout<<"Please input your age: "<<endl;
cin>> age;
cin.ignore();
if ( age < 100 ) {
cout<<"You are pretty young!"<<endl;
}
else if ( age == 100 ) {
cout<<"You are old"<<endl;
}
else {
cout<<"You are really old"<<endl;
}
cin.get();
return 0;
}
OK..now this is the code of the much smaller program that just wont work...whats wrong with it???
Code:
#include <iostream>
using namespace std;
int main()
{
for ( int x = 0; x < 10; x++ ) {
cout<< x <<endl;
}
return 0;
}
Please help!