Question: I need C++ code for this program. Write a program that lets the user play the game Rock, Paper, Scissors against the computer. The program
I need C++ code for this program.
Write a program that lets the user play the game Rock, Paper, Scissors against the computer. The program should work as follows: 1. GET COMPUTER CHOICE: When program begins, a random (integer) number in the range zof 1 through 3 is generate. If number is 1, then computer has choosen "rock". If number is 2, then computer has chosen "paper". If number is 3 then computer has choosen "scissors". (Don't display the computer's choice yet). Use function called getComputerChoice() to do this step. 2. GET USER CHOICE: The user is then asked for and enters their choice of "rock", "paper" or "scissors" at the keyboard. Do this using a function called getUserChoice). NOTE: present user with option to exit the game and do so if they choose this. 3. DISPLAY USER AND COMPUTER CHOICE. Display computer's choice using a function called displayChoice(int x) where x=1 if selected "rock", 2 if selected "paper" and 3 if selected "scissors". Do the same thing for the user. 4. DETERMINE WINNER: Determine who has won (or tie) and print this out to the screen all using the function called determine Winner(int userChoice, int computerChoice) such that the following rules are met: If one player chooses rock and the other chooses scissors, then rock wins (rock smashes scissors) If one player chooses scissors and the other chooses paper, then scissors wins (scissors cut paper) If one player chooses paper and the other chooses rock, then paper wins (paper covers o o o o If both players make the same choice, the game is a tie. 5. Loop back to step 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
