Question: C++ .corn content-rid-8977916,1/courses/17608 201830 Lab%2 Assignment ar / bbcs ebdav pid 22 2204 dt 02-1. 18.pr Lab Assignment 2-1-18 Rock, Paper, Scissors Write a program
.corn content-rid-8977916,1/courses/17608 201830 Lab%2 Assignment ar / bbcs ebdav pid 22 2204 dt 02-1. 18.pr Lab Assignment 2-1-18 Rock, Paper, Scissors Write a program that prompts the user (or "Player 1") to input an integer value between 1 and 3 (where 1 paper, 2 scissor, and 3arock). This input should be passed into a string function called player_ RPS(int), and returns a string value indicating the selection of paper, scissors, or rock (as mentioned above). Next, the returned string value, along with a generated input from the computer, should be passed into a void function called RPScomparison(string, string), and determines whether the user's input or the computer's generated input is the winner or if both inputs result in a tie. Code for creating the computer's generated input is provided below. This snippet of code can be placed into the main function: string computer selection srand (time (O)) int comp-selection = rand () if (comp selection 1) ( 3 + 1; choice "paper"; (comp-selection = if =-2)( else choice } = "scissor"; l else if (comp selection3) ( choice = "rock"; computer selection choice For those who are not accustomed to the Paper, Scissor, Rock game, paper beots rocks, scissor program should resemble the following beats poper, and rock beats scissor. Your output to the Player 1: Enter your choice (1 paper, 2 scissors,3 rock)1 Player 1 entered paper as the choice. Computer entered paper as the choice. THE FINAL RESULT: TIE Player 1: Enter your choice (1-paper, 2 scissors, 3-rock): 2 Player 1 entered scissor as the choice
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
