while (ch != 'A' or ch != 'B') {
}
| ch | ch != 'A' | ch != 'B' | (ch != 'A' or ch != 'B' |
|---|---|---|---|
| 'A' | false | true | true |
| 'B' | true | false | true |
| anything else | true | true | true |
not (a or b) = not a and not b
if (condition) {
}
if (not condition) {
}
setw
if (spin == SpinnerT::ONE_CHERRY) {
bunch of actions with the number 1
} else if (spin == SpinnerT::TWO_CHERRY)
same actions, but with the number 2
} else if (spin == SpinnerT::TWO_CHERRY)
same actions, but with the number 3
...
// I am not overjoyed with this code. see below.
switch (spin) {
case SpinnerT::ONE_CHERRY:
AddCherries(player, 1);
break;
case SpinnerT::TWO_CHERRY:
AddCherries(player, 2);
break;
case SpinnerT::THREE_CHERRY:
AddCherries(player, 3);
break;
....
case SpinnerT::BIRD:
case SpinnerT::DOG:
DeleteCherries(player, 2, SpinnerTToString(spinner);
break;
}
...
if (spin <= SpinnerT::FOUR_CHERRY) {
AddCherries(player, spin);
} else {
DeleteCherries(player, spin);
}
spin = SpinSpinner(); intSpin = SpinnerTToInt(spin) if (intSpin ...)
if (player.human == true) if (player.human == false)
if (player.isHuman) if (not player.isHuman)
if (player.isHuman) {
line 1
line 2
unique line for human
line 3
line 4
} else {
line 1
line 2
unique line for computer
line 3
line 4
}
line 1
line 2
if (player.isHuman) {
unique line for human
} else {
unique line for computer
}
line 3
line 4