Question: I wrote a code that play rock, paper, scissors in with the user in C programming and put it below. How would I use my

I wrote a code that play rock, paper, scissors in with the user in C programming and put it below. How would I use my rock, paper, scissors code to do the rest of the bullet points in C Programming (NOT C++) in the image posted? Please if possible screenshot how it would look like with it compiled. Thanks.

I wrote a code that play rock, paper, scissors in with the

#include

#include

#include

int main()

{

int userMove;

int computerMove;

srand(time(NULL)); //put this line after your variable declarations but before other code

printf("This is a rock, paper, and scissor game. Please enter a move(1=Rock, 2 =Paper, 3=Scissors):");

scanf("%d", &userMove);

printf(" Computer chooses ");

computerMove=1+rand()%3;

if(computerMove==1)

{

printf("Rock! ");

}

else if(computerMove==2)

{

printf("Paper! ");

}

else if(computerMove==3)

{

printf("Scissor! ");

}

else printf("Tie!");

//{

if ((userMove==1)&&(computerMove==1))

{

printf(" Tie!");

}

else if ((userMove==1)&&(computerMove==2))

{ printf(" Computer Wins!");

}

else if ((userMove==1)&&(computerMove==3))

{ printf(" User Wins!");

}

else if((userMove==2)&&(computerMove==1))

{ printf(" User Wins!");

}

else if((userMove==2)&&(computerMove==2))

{ printf(" Tie!");

}

else if((userMove==2)&&(computerMove==3))

{ printf(" Computer Wins!");

}

else if((userMove==3)&&(computerMove==1))

{ printf(" Computer Wins!");

}

else if((userMove==3)&&(computerMove==2))

{ printf(" User Wins!");

}

else if((userMove==3)&&(computerMove==3))

{ printf(" Tie!");

}

else

{ printf("You have select an invalid selection.");

}

}

Goals 1. Create a program that tallies game outcomes using arrays Tasks Write code that calculates statistics for playing your Rock/Paper/Scissors game Change your program to make each round of the game a separate function call (e.g. a function called PlayRPS0 results in playing exactly one game with the user) Ask the user how many times to play, then call the function that many times Maintain the counts for each move (selected by either player) in an array you may use a global array this time only because you don't know yet how to do it differently) After you have played the requested number of times print the statistics for the user Make sure that your code compiles and runs successfully Submit your main.c C code via "Worksheet Assignment 18" in Blackboard Some example runs of the program are shown in the table below. Play how many times? 3 Enter a move (1-Rock, 2 Paper, 3 scissors): 1 Computer selected Paper Computer wins Enter a move (1 Rock, 2 Paper, 3 scissors) 1 Computer selected Scissors User wins Enter a move (1 Rock, 2 Paper, 3 scissors) 1 Computer selected Rock Tie Enter a move (1 Rock, 2 Paper, 3 cissors 1 Computer selected Scissors User wins Game statistics Number of times Rock selected 5 Number of times Paper selected: 1 Number of times Scissors selected

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!