Additionally, each time you use a comparison operator, it must have an operand on each side (there is no such thing as implicit operands). That is, the following: 'if (x < 2 && > 1)' meaning, 'if x less than 2 and x is greater than 1' will not fly.
There is no real reason to do this in this case, but you could also put people into age 'bins', and use a switch:
Code:
enum age_category { ac_toddler, ac_kid, ac_teenager, ac_adult, ac_older_than_dirt };
age_category cat;
if(age < 5)
cat = ac_toddler;
// etc...
else
cat = ac_older_than_dirt;
switch(cat)
{
case ac_toddler:
std::cout << "A toddler!" << std::endl;
break;
// etc...
}
The only reason to do this would be if you needed that information (which category a person is in) too often to make recomputing it tedious (... if the code would show up many places).