Hello, could you please look at my code. It suppose to make the user type in a number, if the number is over 16 it will print out something, and if the number is under 16 something else will be printed out. At the moment it seems to print out both lines no matter what.
int main()
{
int x;
int y;
cout <<"hello my friend, what's your age?" <<endl;
cin >> x;
if (x <= 16){
cout << x <<" your a young one huh" <<endl;
}
if (y >=16){
cout << "get out of here you grumpy old one."<< endl;
}
return 0;
}
Thanks alot of whatever help you guys can give me :)
total new to this.
That's a good question, thx for helping me you just got me to understand that i only needed the X, so i just removed Y from the code. Works perfectly :)