Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C (GNU GCC (MinGW)) Write a program that lets the user play the Rock, Paper, Scissors game against the computer. The

image text in transcribedimage text in transcribedimage text in transcribed

Write a program in C (GNU GCC (MinGW)) Write a program that lets the user play the Rock, Paper, Scissors game against the computer. The computer first chooses randomly between rock, paper and scissors, but does not display its choice. It displays a menu of choices: rock, paper, scissors, or quit, and prompts the user to select a choice. If the user's input does not match a choice on the menu, the program displays the menu again and prompts the user to reenter (You can assume the user always enters an integer). It then determines who is the winner, then displays the user's and computer's choice and a message to indicate the winner (user or computer or tie). The rules to determine the winner are: rock beats scissors, scissors beats paper and paper beats rock. The program loops to allow the user to play repeatedly multiple games, and at each iteration of the loop, the cumulative scores are displayed (i.e. how many times the user won and how many times the computer won). The user has the option to quit at the end of a game Additional requirements - Make sure you meet all the requirements to avoid losing points Your program must generate a different set of random values each time it is executed x You should implement these functions getUserChoice: displays the menu, prompts the user to enter the choice, performs input validation, displays the menu again if the input is invalid (is not equal to any of the choices on the menu). Returns the user's choice (rock, paper, scissors or quit) if it is valid getComputerChoice: uses the random number generator to randomly select a choice and returns the computer's choice determineWinner: takes as arguments the user's choice and the computer's choice and determines the winner. Prints the user's and computer's choices and who is the winner (computer or user or tie). This function also prints the user's and computer's cumulative score (i.e. how many times the user won and how many times the computer won) Make sure determineWinner function correctly determines the winner without using any statement such as theif, if/else, if/else if or switch statement any logical operator: && (logical AND), II (logical OR) . any relational operator (>, >=.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

d. What language(s) did they speak?

Answered: 1 week ago

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago