Originally Posted by
mattflick
I want to change the output from just saying "You win" to You chose (paper rock or scissors) and I chose (paper rock or scissors. You win, You lose or You Tie.
Perhaps something like this.
Code:
void report(outcome result, int *win_cnt_ptr,
int *lose_cnt_ptr, int *tie_cnt_ptr,
p_r_s player_choice, p_r_s machine_choice)
{
static const char *text[] = { "paper", "rock", "scissors" };
printf("You chose %s, Machine chose %s : You ",
text[player_choice], text[machine_choice]);
switch ( result )
{
case win:
++*win_cnt_ptr;
puts("win.");
break;
case lose:
++*lose_cnt_ptr;
puts("lose.");
break;
case tie:
++*tie_cnt_ptr;
puts("tie.");
break;
default:
printf("PRGORAMMER ERROR: Unexpected result!\n\n");
exit(1);
}
}