Answered step by step
Verified Expert Solution
Question
1 Approved Answer
not really sure why it making my code not do what I want it to. I don't have what it's saying I have and I'm
not really sure why it making my code not do what I want it to. I don't have what it's saying I have and I'm sure it's just some error I missed. please help me fix it and zoom in if needed!
The numbers 1, 2 and 3 represent the following game pieces 1 = Rock 2 = Paper 3 = Scissors If the user enters 1 (rock) and the computer generates 2 (paper), the computer wins, as paper covers rock. For 2 (paper) and 3 (scissors) 3 wins, as scissors cut paper. But since rock breaks scissors, 1 (rock) wins against 3 (scissors). Generate a random number between 1 and 3 and store it as the computer's choice and read in the user's choice. Determine who the winner is by comparing the computer's choice to the user's choice. There can be nine possible combinations of user and computer-generated entries. You will use if-else-if and the & & operator to make all the combinations happen. Your output should match one of the following examples: Your entry: 1 (rock) Computer generated: 1 (rock) It's a tie! Your entry: 2 (paper) Computer generated: 3 (scissors) Scissors cut paper. Computer wins ! Your entry: 1 (rock) Computer generated: 2 (paper) Paper covers rock. Computer wins! Your entry: 3 (scissors) Computer generated: 1 (rock) Rock breaks scissors. Computer wins ! Your entry: 1 (rock) Computer generated: 3 (scissors) Bock breaks scissors. You win! Your entry: 3 (scissors) Computer generated: 2 (paper) Scissors cut paper. You win! Your entry: 2 (paper) Computer generated: 1 (rock) Paper covers rock, You win! Your entry: 3 (scissors) Computer generated: 3 (scissors) It's a tie! Your entry: 2 (paper) Computer generated: 2 (paper) It's a tie! Invalid entry. The input must be a number between 1 and 3. Your program should incorporate the following objectives: Proper comments/documentation Self-documenting variable names Read in an unsigned integer that can be used as a seed value for the random number generator (the seed value is the first value read Paper covers rock. You win! It's a tie! Your entry: 2 (paper) Computer generated: 2 (paper) It's a tie! Invalid entry. The input must be a number between 1 and 3. Your program should incorporate the following objectives: . Proper comments/documentation Self-documenting variable names . Read in an unsigned integer that can be used as a seed value for the random number generator (the seed value is the first value read in and is necessary for auto-grading your program) Generate a random number between 1 and 3 (for help generating a number between 1 and a maximum range, see the program randomnumbetween 1and_maxrange.cpp posted on Bb under Course Content, Module 3, Lesson 2, 1(a) Read in a number between 1 and 3 that represents the user's choice Output the user's choice, computer's choice, and who wins in the specified format. If the input is invalid a message formatted as specified should be displayed . When the input is as shown in Figure 1 (10 is the seed and 1 is the user's choice), your program should produce the output as shown in Figure 2. Figure 1: (sample input) 1 Figure 2: (sample output) Your entry: 1 (rock) Computer generated: 2 (paper) Paper covers rock. Computer wins! 286488.1697136 5 #include
Step 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