Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is lab3 solution, help please! Project 2 Rock, Paper, Scissors Updated Take the solution to Lab 3 and make sure the user enters a

image text in transcribed

this is lab3 solution, help please!

image text in transcribed

Project 2 Rock, Paper, Scissors Updated Take the solution to Lab 3 and make sure the user enters a letter of R, P, or S and the computer generates a number between 0-2 and changes that number to a letter of R, P or S, using a switch. Make sure the user knows why he/she has won or lost-print a message like "Paper covers Rock" or "Scissors cuts Paper". Ask the user how many times he/she wants to play and incorporate that into a for loop or allow the user to keep playing until he/she says to stop using a do-while loop. Add the code to count how many wins, losses and ties that the user has and print the results at the end of the program before stopping the program. Allow the user to exit a game, not the program, if he wants to-use a code of 'X' Also keep a count of exits from a game. Make sure your run has at least one exit. Also have the program determine if a user did not type in R, P, S or X and print "Bad Code" and allow the user to continue the game. Run at least once with a "Bad Code" iqstream> time.h> #inc #include using namespace std; int main() // Generate a random value between 0-2 srand(time(0)); I/ Seed the time int program LValue-rand()%(3); char converted value char user value; // Convert computer value switch(program_value) case 0: converted value-'S' break case 1: converted value-'R' break; case 2 convertedvalue- break; - // Ask user to enter- S,R,P cout>user value; // Validate if user entered only S,R,P // Check who worn if(converted value-- 'S' && user_value 'S')

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions