+ 2
C++ ??How to determine if two integers are equal without using camparison...
It has some banned keyword : define, include, using, if, ":", switch. You just can include <iostream>. Can you help me this homework. Thanks a lot.
4 Respostas
+ 5
The bitwise exclusive OR operator would only yield 0 if both operands are equal (you could also use a subtraction, but bitwise operations are cooler).
https://www.sololearn.com/learn/4074/?ref=app
Since 0 translates to false and every other value to true in a boolean sense, you can use the logical NOT operator to return true for equal values and false for all others.
+ 3
Martin Taylor I wrote "exclusive OR" above, wouldn't that be equal to XOR in terms of meaning? Or am I mixing something up right now?