Very new to C++ or other programming, stuck on IF's
I just started learning the C++ language. Right now I'm using the tutorial on this site and I got to the IF statements. I read the FAQ's and all they had on my problem was that the compilers in C++ don't recognize the codes or something like that until you press ENTER. My problem is this; I set my program up like this:
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;
}
When I press ENTER after putting in a number the window just closes and doesn't give me an answer. I am using BloodshedDev-C++ maybe I need a different one? Please help I just started doing this and this problem sort of stopped me.
:confused:
On the same line? or below it?
On the same line? or below it?
umm, Thank's guy's you helped a lot!
umm, Thank's guy's you helped a lot!