I need a code that return True if only one or two of three params are true
what is the shortest/best way?
I'm addicted to this question!
bool MyFourthAnswer(bool a, bool b, bool c)
{
return (a != b) || (b != c);
}
Just check whether at least one of the values is set and not all three values are set:
bool result = (a | b | c) & !(a & b & c);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With