when i create a program and compile and run eg this program
#include
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
}
cin.get();
return 0;
}
i put in a age when i have compiled and run it but then when i press returne it closes am i doing anything wrong if i am what and how do i fix it plzz tell me if u know
#include
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
}
cin.get();
return 0;
}
i put in a age when i have compiled and run it but then when i press returne it closes am i doing anything wrong if i am what and how do i fix it plzz tell me if u know