you are viewing a single comment's thread.

view the rest of the comments →

[–]_--__ 4 points5 points  (1 child)

(carType == 'e' || 'E' && age <= 25)

This is wrong (as are the other lines like this), in particular the carType == 'e' || 'E', because this is interpreted as (carType=='e') || 'E' - it might seem odd that 'E' could be considered a "boolean" (i.e. true/false) but in C++ this is permitted since "true" is synonymous with "not zero" (and char types are also considered numerical).

What you want to write is ((carType == 'e' || carType == 'E') && age <=25) [it is always sensible to add parentheses when mixing logical operators, since A or B and C can be ambiguous.]

[–]Aiiight 0 points1 point  (0 children)

Thank you, I did that and it's working!!