Now that we know the results, it’s time to determine the winner!
Inside your if/else statement that prints out odd or even, add another set of if/else statements to tell who the winner is, based on what the player chose back in stage 1.
Here is some "pseudo code" (notation resembling simplified code, not real code) that you can use to write the real code.
if (the sum was even) {
print out even
if (the user chose evens) {
the user wins
}
else {
the computer wins
}
else {
// inverse of above if statement
}
}
Here is an example of what the output of your stage three should produce:
>Let’s play a game called "Odds or Evens"
>What is your name?
Douglas
>Hi Douglas, which do you choose? (O)dds or (E)vens?
O
>Douglas has picked odds! The computer will be evens.
---------------------------------------
>How many fingers do you throw?
4
>The computer plays 4 "fingers".
---------------------------------------
4 + 4 = 8
8 is... even!
That means the computer wins!