Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Lab 3 - Rock, Paper, Scissors Objectives: To use If-Statements to affect the log

ID: 3678389 • Letter: L

Question

Lab 3 - Rock, Paper, Scissors Objectives: To use If-Statements to affect the logical flow of your program To use Switch Statements To design a game and have fun You need to write a program to play "Rock, Paper, Scissors" Start by have the player input his/her choice-"R,'S', or ‘P'. Hint, what data type should you use here? Then have the computer generate its choice randomly (0, , or 2). Remember to seed your random generator at the top of the main method. Now that you have the numeric choice, you will need to convert (using a Switch statement) it into a letter (“R", "S', orP'.) Then determine the winner of the game. Remember that Rock crushes Scissors, Paper covers Rock, and Scissors cuts Paper. Have fun with this one. If you are up for an extra challenge, consider how you would introduce lizard and Spock into the game for rock, paper, scissors, lizard, Spock. Run: Make sure that you gain at least one win, one loss, and one tie. Do as many attempts as necessary to gain all three of these outcomes. Submission: Turn in the source program and your output. Please show all of the attempts, even if they are duplicates. (Include all of your wins, all of your losses, and all of your ties in the output) Please turn both the cpp file and the output text into drop box. See Lab 1's instruction sheet for details on how to document, save, and turn in your work. 1 CSE 1311 Pierce

Explanation / Answer

#include #include #include #include using namespace std; // starting main function int main(){ // set the char variable for the y/n while loop. I have learned since that a bool statement // might have been a little better for the loop char ch; // set up my variables for the scores int win = 0; int tie = 0; int lose = 0; // start of game loop, the loop will run untill ch == n do{ int choice; // Fancy printed title, well as fancy as I can do. cout