Question: implement a game of rock, paper, scissors between a user and the computer. take a look at the specifications for how your program needs to

implement a game of rock, paper, scissors between a user and the computer. take a look at the specifications for how your program needs to operate:

  • The user must be prompted for the number of games the user wants to play.
  • The program should keep track of the score of both the computer and the human.
  • The program should keep running until the number of games specified are completed.
  • During each turn, the computer randomly selects its choice.
  • After each turn, the program should display who won the previous round and the score after that turn.
  • After all matches are played, a summary of the final score is displayed

Here's my code so far:

/*Kitundu Kitundu

*C48424127

*CPSC 1011

*Lab 5

*/

#include

#include

#include

int main(void) {

int R;

int P;

int S;

int matches;

int player;

int playerscore;

int computer;

int compscore;

int choices;

printf("Staring the CPSC 1011 Rock, Paper, Scissors Game! ");

printf("Enter the number of matches to play: ");

scanf("%d", &matches);

for(int i=0; i

printf("Match %d: Enter R for rock, P for paper, or S for scissors: ",matches);

scanf("%d", &matches);

computer=rand()%3+1;

if(choices==R){

if(computer==R){

printf("The computer chose rock. You tied. ");

}

if(computer==P){

printf("The computer chose paper. You lose. ");

}

if(computer==S){

printf("The computer chose scissors. You win! ");

}

}

if(choices==P){

if(computer==R){

printf("The computer chose rock. You win!. ");

}

if(computer==P){

printf("The computer chose paper. You tied. ");

}

if(computer==S){

printf("The computer chose scissors. You lose. ");

}

}

if(choices==S){

if(computer==R){

printf("The computer chose rock. You lose. ");

}

if(computer==P){

printf("The computer chose paper. You win! ");

}

if(computer==S){

printf("The computer chose scissors. You tied ");

}

}

return(0);

}

}

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!