If statement

Jun 17, 2012 at 10:55pm
Im making a test with if-statement. And if i want to make the (if) between two numbers? how do i do that?

for example...

if (age == 13-17){
cout <<"your a teenager";
}

And i need help with the "13-17". Please reply if you know the anwser :)
Jun 17, 2012 at 11:06pm

Hello,

How about checking if the number is greater than 13 and less than 17?

if age > 13 and age < 17

Jimbot
Jun 18, 2012 at 12:37am
using && instead of and, may also help improve the readability!
Jun 18, 2012 at 10:54am
1
2
3
4
if(age>=13&&age<=17)
{
         cout <<"your a teenager";
}


how about that?
Jun 18, 2012 at 6:20pm
Thanks! it really helped :D
Jun 18, 2012 at 6:30pm
This is driving me nuts..."you're".
Topic archived. No new replies allowed.