Hello I am a newbie & I know you people have better things to do then help me but I would really like it if someone can help me with this problem.
I read a program that looks that the one bellow. It works but when I add my age & press enter the program exits. Is there a code that I can add so that the program only exits when I type "exit" or any key word that I choose?
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;
}
You can download the code at the Attach file: