I'm going to post the whole section of code. The program itself spreads itself over 5 files. The logic I used was to return the players_choice and machine_choice to report.c. The problem seems to be that my print statements no longer print the enum value 0, 1, or 2. I get a number 8-10 digit integer number instead. Its like they are calling something else. Its quite frustrating.
Code:
#include "p_r_s.h"
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)
{
// New code added to address arrary to variable name conversion
char* names[] = {"paper","rock","scissors"};
// End new code
switch (result) {
case win:
++*win_cnt_ptr;
//printf("%27sYou win.\n", "");
printf("%s%d%s%d%s\n", "You chose ", player_choice,
" and I chose ", machine_choice, " You win.\n");
break;
case lose:
++*lose_cnt_ptr;
// New code
//printf("%s%s%s%s%s\n", "You chose ", names[player_choice],
//" and I chose ", names[machine_choice], " You lose.\n");
// End new code
printf("%27sYou lose.\n", ""); // Old Code
break;
case tie:
++*tie_cnt_ptr;
// New Code
//printf("%s%s%s%s%s\n", "You chose ", names[player_choice],
//" and I chose ", names[machine_choice], " A tie.\n");
// End new code
printf("%27sA tie.\n", ""); // Old code
break;
default:
printf("PROGRAMMER ERROR: Unexpected result!\n\n");
exit(1);
}
}