Question: void computeOutcome( int computer_pick, int user_pick, char *users_pick_string, char *computers_pick_string ) { // you never lose here because of a logical error! // do you

void computeOutcome( int computer_pick, int user_pick, char *users_pick_string, char *computers_pick_string ) {

// you never lose here because of a logical error! // do you know why? // // well you need to fix the bug - so hopefully you do.

// logic: // the computer wins if it is one ahead of user in a 'circular' list // rock paper scissors // rock paper scissors // rock paper scissors

// replace the below "0" with conditional statement where the // computer wins. // // HINT: // to check whether the computer pick is clockwise // one unit 'ahead; of user pick, imagine // that the list is circular

if( 0 ) // computer wins, because it is clockwise one unit away // from what user selected. { printf( " %s (you) < %s (puter) You Lost " , users_pick_string, computers_pick_string ); } else if( computer_pick == user_pick ) { printf( " %s (you) = %s (puter) It's a TIE " , users_pick_string, computers_pick_string ); } else { printf( " %s (you) > %s (puter) You Won " , users_pick_string, computers_pick_string ); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!