Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Dev C++ for program and include all of the following. Im lost. Please help ASAP! Make sure the user enters a letter of R,

Use Dev C++ for program and include all of the following. Im lost. Please help ASAP!

image text in transcribed

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.

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.

Heres what I have so far:

#include #include #include #include using namespace std;

int main() { char user, computer = ' '; int ComputerChoice= rand() % 3;

srand(time(0));

//Input Statements cout > user;

switch(ComputerChoice) {case 0: computer = 'R' ; case 1: computer = 'S' ; case 2: computer = 'P' ; }

//Output Statements if(user == computer) {cout Objectives: To use If-Statements to affect the logical flow of your program To use Switch Statements *lo design a game and hav e fun Instructions: 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, 1, 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', or 'P'.) Then determine the winner of the game. Remember that Rock crushes Scissors, Paper covers Rock, and Scissors cuts Paper

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

More Books

Students also viewed these Databases questions