Let's say we have four variables: int a, b, c, d;
. I need to check if excatly two of them are equal.
So for example: 1 1 9 5
is true, but 3 9 8 4
and 3 3 3 1
are false.
Of course writing an if statement for this would take a lot of time, won't be easily readable and it would be easy to make a mistake writing it.
What is the best way to write such statement?
Aucun commentaire:
Enregistrer un commentaire