Code:
#include <iostream.h>
int main() //Most important part of the program!
{
int age; //Need a variable...
cout<<"Please input your age: "; //Asks for age
cin>>age; //The input is put in age
if(age<100) //If the age is less than 100
{
cout<<"You are pretty young!"; //Just to show it works
}
else if(age==100) //I use else just to show an example
{
cout<<"You are old"; //Just to show you it works...
}
else
{
cout<<"You are really old"; //Executed if no other statement is executed
}
return 0;
}
For some reason, my dos prompt closes after its done with the results, i dont have XP so i cant just right click on the program and go to "program" tab.
Also someone said to place cint>>whatever ?? Since im new at this, i dunno what he's talking about, i just want the dos screen to stay so i can see results in the .exe
Also,going to properties in the dos screen doesnt help, i unchecked the thing that said "close when exit" or something, it still closes after it runs. Any help?
(this is in the tutorials at cprogramming.com btw, the second tutorial.)