Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For some reason when creating this rock, paper, scissors program, no matter what I input the computer always chooses paper. And the results of the
For some reason when creating this rock, paper, scissors program, no matter what I input the computer always chooses paper. And the results of the game are always "You Tied" even when it is clear that the user has beaten the computer. Is there any way to fix this?
int main (void) int numMatches; I number of matches that will be played / int roundMatch; II current round number that is being played int compChoice; // the choice of "rock, paper, or scissors that the computer will make // char userChoice; // the choice of "rock, paper, or scissors that the user will make // int R; // rock int P; I/ paper11 int S; 1/ scissors 11 printf("Starting the CPSC 1011 Rock, Paper, Scissors Game!n"); printf("Enter the number of matches to play:") scanf(" %d", &nunMa tches); numMatches nunMatches + 1; compChoice- (rand() % 3) ;; // to 2 // P-1; for (roundMatch# 1; roundMatchStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started