can this be done somehow?
if((a || b) == 0) return 1;
return 0;
so its like…if a OR b equals zero, then…but it is not working for me.
my real code is:
bool Circle2::contains(Line2 l) {
if((p1.distanceFrom(l.p1) || p1.distanceFrom(l.p2)) <= r) {
return 1;
}
return 0;
}
You need to write the full expression:
And in the second code:
If you do
((a || b) == 0)this means “Is the logical or ofaandbequal to 0. And that’s not what you want here.And as a side note: the
if (BooleanExpression)return true; else return falsepattern can be shortened toreturn BooleanExpression;