Question
need help, dont understand how to set up.
1 You are a game developer at Microsoft Corporation and are charged with the task of developing games in C++. 2 Please develo
A. Player One: person You need to ask the person to enter one option from the above three. 10 B. Player Two: computer The sys
D. When the player wins, the player got 1 score for each round. If it is a draw, both players got 0 score. E. The game should
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans:-

Code:

#include<iostream>
#include<time.h>

using namespace std;

int main()
{
int score_p1=0,score_p2=0;
char answer = 'y';
cout<<"select from following options"<<endl;
cout<<"1. Rock"<<endl;
cout<<"2. paper"<<endl;
cout<<"3. scissor"<<endl;
while(answer=='Y' || answer =='y')
{
int p1, p2;
cout<<"select one option from above three"<<endl;
cout<<"p1 =";
cin>>p1;
  
srand(time(NULL));

p2= rand()%3 + 1;
cout<<"p2 = "<<p2<<endl;
  
if((p1+p2)%2!=0)
{
if(p1>p2)
{
cout<<"p1 wins"<<endl;
score_p1+=1;
}
else
{
cout<<"p2 wins"<<endl;
score_p2+=1;
} }
  
else
{
if(p1<p2)
{
cout<<"p1 wins"<<endl;
score_p1+=1;
}
else if(p1==p2)
cout<<"Draw"<<endl;
else
{
cout<<"p2 wins"<<endl;
score_p2+=1;
}
}
cout<<"would you like to continue Y/y or N/n"<<endl;
cin>>answer;
}
cout<<"final score of p1 is "<<score_p1<<endl;
cout<<"final score of p2 is "<<score_p2<<endl;
if(score_p1 > score_p2)
cout<<"You wins"<<endl;
else if(score_p1 == score_p2)
cout<<"Draw"<<endl;
else
cout<<"Computer wins"<<endl;
return 0;
}

Screenshot of code:-

Run Debug Stop e Share Save {} Beautify Language C++ @ main.cpp #include<iostream> 2 #include<time.h> 4 using namespace std;

Output:

Willy UPLIUS 1. Rock 2. paper 3. scissor select one option from above three pl =2 p2 = 2 Match draw would you like to continu

P.S. - If you find my answer useful, please take a second to give it a THUMBS UP.

Add a comment
Know the answer?
Add Answer to:
need help, dont understand how to set up. 1 You are a game developer at Microsoft...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please help me fix this. I'm getting it all mixed up in user defined functions. here's...

    please help me fix this. I'm getting it all mixed up in user defined functions. here's the question. This week we'll write a C program that lets the user play the game of Rock, Paper, Scissors against the computer. Your program will call a user-defined function named display_rules that displays the rules of the game. It then proceeds to play the game. To determine the winner, your program will call another user- defined function called determine_winner that takes two integer...

  • Write a program that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a...

    Write a program that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws. Here are sample runs: Enter your selection: scissor (0),...

  • Assignment C++: Rock-Scissor-Paper & Tic-Tac-Toe i need you to write two different program for RSP and...

    Assignment C++: Rock-Scissor-Paper & Tic-Tac-Toe i need you to write two different program for RSP and TTT: R-S-P Requirement: - write one program that mimics the Rock-Scissor-Paper game. This program will ask user to enter an input (out of R-S-P), and the computer will randomly pick one and print out the result (user wins / computer wins). - User's input along with computer's random pick will be encoded in the following format: -- user's rock: 10 -- user's scissor: 20...

  • This program should be in c++. Rock Paper Scissors: This game is played by children and...

    This program should be in c++. Rock Paper Scissors: This game is played by children and adults and is popular all over the world. Apart from being a game played to pass time, the game is usually played in situations where something has to be chosen. It is similar in that way to other games like flipping the coin, throwing dice or drawing straws. There is no room for cheating or for knowing what the other person is going to...

  • Good evening, here is a C program question. I wanna to write a very small game....

    Good evening, here is a C program question. I wanna to write a very small game. The rule of the game is like rock scissors. Both of the player and the computer generate a letter taking the value A, B, C. And A<B, B<C, C<A (Like rock scissors game, rock<cloth, cloth< scissor, scissor<rock) Requirement 1: New users need to register an account with a username and password. Actually, the account should be a structure type variable containing: a username, a...

  • Write a program in the Codio programming environment that allows you to play the game of...

    Write a program in the Codio programming environment that allows you to play the game of Rock / Paper / Scissors against the computer. Within the Codio starting project you will find starter code as well as tests to run at each stage. There are three stages to the program, as illustrated below. You must pass the tests at each stage before continuing in to the next stage.  We may rerun all tests within Codio before grading your program. Please see...

  • Need help, a bit confused. Thank you. 2) (10 points) Assuming there is an offline game,...

    Need help, a bit confused. Thank you. 2) (10 points) Assuming there is an offline game, once players finish the game, the final score would be stored in a score file. Now we have multiple players playing that game. Each player needs to play that game in two computers "Alpha" and "Beta". So there are two score files generated separately in two computers. Our goal is to check those two files and join the score for each player together to...

  • 5.12 A5 Program Do you want to play. a. game? The Big Bang Theory fans may...

    5.12 A5 Program Do you want to play. a. game? The Big Bang Theory fans may recognize Rock Paper Scissors Lizard Spock as a game of chance that expands on the standard Rock Paper Scissors game. It introduces two new hand signs and several more rules. The rules: • Scissors cuts Paper • Paper covers Rock • Rock crushes Lizard • Lizard poisons Spock • Spock smashes Scissors • Scissors decapitates Lizard • Lizard eats Paper • Paper disproves Spock...

  • C++ You are asked to implement scissors-rock-paper game where the players are a computer and a...

    C++ You are asked to implement scissors-rock-paper game where the players are a computer and a user. The player that wins 3 hands successively is the winner of the game. Your program should prompt the user with a message at the beginning of each hand to enter one of scissors, rock or paper. If the user’s entry is not valid, i.e. entry is neither scissors, rock, nor paper, your program throws a message to the user to enter a valid...

  • PLEASE INCLUDE SAW-PROMPTS FOR 2 PLAYERS NAMES(VALIDATE NAMES). SHOW MENU (PLAYER MUST SELECT FROM MENU B4...

    PLEASE INCLUDE SAW-PROMPTS FOR 2 PLAYERS NAMES(VALIDATE NAMES). SHOW MENU (PLAYER MUST SELECT FROM MENU B4 THE GAME STARTS 1=PLAY GAME, 2=SHOW GAME RULES, 3=SHOW PLAYER STATISTICS, AND 4=EXIT GAME WITH A GOODBYE MESSAGE.) PLAYERS NEED OPTION TO SHOW STATS(IN A DIFFERNT WINDOW-FOR OPTION 3)-GAME SHOULD BE rock, paper, scissor and SAW!! PLEASE USE A JAVA GRAPHICAL USER INTERFACE. MUST HAVE ROCK, PAPER, SCISSORS, AND SAW PLEASE This project requires students to create a design for a “Rock, Paper, Scissors,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT