C++ “OR” operator

后端 未结 9 1496
无人及你
无人及你 2021-01-19 03:37

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.

9条回答
  •  醉话见心
    2021-01-19 03:55

    C++ isn't that smart. You have to do each comparison manually.

    bool Circle2::contains(Line2 l) {
    if((p1.distanceFrom(l.p1) <= r) || (p1.distanceFrom(l.p2) <= r)) return 1;
        return 0;
    }
    

提交回复
热议问题