This will be a menu-driven program. The menu should loðk IIKE IS. Menu ==== 1. Play rock-paper-scissors 2. Play Yahtzee 3. Exit Enter your choice: Specs for the menu 1. The program should continue to run until the user chooses #3 from the menu. 2. If the user enters a non-valid menu choice (for example, 5) your program should print an error message that explains (in a complete sentence) what happened. It should keep running, though. 3. You should clear the screen each time before printing the menu. To do that, use this code: cout << "Press to continue" « endl; cin.get (); system ("cls"); 4. The menu should use a switch statement to process the user's input. Play rock-paper-scissors specs Two players choose either rock, paper, or scissors and compare their choices. rock beats scissors (rock breaks or dulls scissors) b. scissors beats paper (scissors cut paper) 1. a. C. paper bears rock (paper covers rock) Ask the user for the number of game wins it will take to win a match; this must be an odd number. Use a loop to validate user input to make sure s/he enters an odd number. Now your program will generate the choices for two players by using a random number generator to simulate the players' "choices" (of rock, paper, or scissors). Review random numbers in section 3.9 in the text. 4. Make sure you "seed" the random number generator as shown in Program 3-25. 5. You will be printing out each game in the match and telling the score after each game. A match is one or more games. Suppose the user entered that it will take 3 game wins to win the match. The output would look similar to this: 2. 3. game #1 playerl : rock player2 : scissors playerl = 1, player2 = 0 game #2 player 1 : paper player 2 : paper playerl = 1, player2 = 0 Notice this game was a tie, so the scores didn't change дame #3 player 1 : paper player 2: scissors playerl = 1, player2 = 1
This will be a menu-driven program. The menu should loðk IIKE IS. Menu ==== 1. Play rock-paper-scissors 2. Play Yahtzee 3. Exit Enter your choice: Specs for the menu 1. The program should continue to run until the user chooses #3 from the menu. 2. If the user enters a non-valid menu choice (for example, 5) your program should print an error message that explains (in a complete sentence) what happened. It should keep running, though. 3. You should clear the screen each time before printing the menu. To do that, use this code: cout << "Press to continue" « endl; cin.get (); system ("cls"); 4. The menu should use a switch statement to process the user's input. Play rock-paper-scissors specs Two players choose either rock, paper, or scissors and compare their choices. rock beats scissors (rock breaks or dulls scissors) b. scissors beats paper (scissors cut paper) 1. a. C. paper bears rock (paper covers rock) Ask the user for the number of game wins it will take to win a match; this must be an odd number. Use a loop to validate user input to make sure s/he enters an odd number. Now your program will generate the choices for two players by using a random number generator to simulate the players' "choices" (of rock, paper, or scissors). Review random numbers in section 3.9 in the text. 4. Make sure you "seed" the random number generator as shown in Program 3-25. 5. You will be printing out each game in the match and telling the score after each game. A match is one or more games. Suppose the user entered that it will take 3 game wins to win the match. The output would look similar to this: 2. 3. game #1 playerl : rock player2 : scissors playerl = 1, player2 = 0 game #2 player 1 : paper player 2 : paper playerl = 1, player2 = 0 Notice this game was a tie, so the scores didn't change дame #3 player 1 : paper player 2: scissors playerl = 1, player2 = 1
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Instructions for the assignment can be found in the picture linked to this post. The
Program 3.25
// This program demonstrates random numbers.
#include <iostream>
#include <cstdlib> // For rand and srand
#include <ctime> // For the time function
using namespace std;
int main()
{
// Get the system time.
unsigned seed = time(0);
// Seed the random number generator.
srand(seed);
// Display three random numbers.
cout << rand() << endl;
cout << rand() << endl;
cout << rand() << endl;
return 0;
}
![This will be a menu-driven program. The menu should look like this:
Menu
====
1. Play rock-paper-scissors
2. Play Yahtzee
3. Еxit
Enter your choice:
Specs for the menu
1. The program should continue to run until the user chooses #3 from the menu.
If the user enters a non-valid menu choice (for example, 5) your program should print an error
message that explains (in a complete sentence) what happened. It should keep running, though.
3. You should clear the screen each time before printing the menu. To do that, use this code:
2.
cout <« "Press <Enter> t o continue" << endl;
//
cin.get () ;
system ("cls");
4. The menu should use a switch statement to process the user's input.
Play rock-paper-scissors specs
1. Two players choose either rock, paper, or scissors and compare their choices.
rock beats scissors (rock breaks or dulls scissors)
а.
scissors beats paper (scissors cut paper)
b.
С.
paper bears rock (paper covers rock)
Ask the user for the number of game wins it will take to win a match; this must be an odd number.
Use a loop to validate user input to make sure s/he enters an odd number.
Now your program will generate the choices for two players by using a random number generator
to simulate the players' "choices" (of rock, paper, or scissors). Review random numbers in section
3.9 in the text.
2.
3.
4. Make sure you "seed" the random number generator as shown in Program 3-25.
5. You will be printing out each game in the match and telling the score after each game. A match is
one or more games. Suppose the user entered that it will take 3 game wins to win the match. The
output would look similar to this:
game #1
playerl :
player2 : scissors
playerl
rock
= 1, player2 = 0
game #2
player 1
player 2
playerl = 1, player2 = 0
: рарer
: paper
Notice this game was a tie, so the
scores didn't change
game #3
player 1
player 2
playerl = 1, player2
: раper
: scissors
%3D
= 1](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F56e62b82-6189-4c1a-8a39-c4eca854fd80%2F3ab18701-e1f8-46c5-b2d9-4e3b4343d4b8%2Fpxe3zds_processed.jpeg&w=3840&q=75)
Transcribed Image Text:This will be a menu-driven program. The menu should look like this:
Menu
====
1. Play rock-paper-scissors
2. Play Yahtzee
3. Еxit
Enter your choice:
Specs for the menu
1. The program should continue to run until the user chooses #3 from the menu.
If the user enters a non-valid menu choice (for example, 5) your program should print an error
message that explains (in a complete sentence) what happened. It should keep running, though.
3. You should clear the screen each time before printing the menu. To do that, use this code:
2.
cout <« "Press <Enter> t o continue" << endl;
//
cin.get () ;
system ("cls");
4. The menu should use a switch statement to process the user's input.
Play rock-paper-scissors specs
1. Two players choose either rock, paper, or scissors and compare their choices.
rock beats scissors (rock breaks or dulls scissors)
а.
scissors beats paper (scissors cut paper)
b.
С.
paper bears rock (paper covers rock)
Ask the user for the number of game wins it will take to win a match; this must be an odd number.
Use a loop to validate user input to make sure s/he enters an odd number.
Now your program will generate the choices for two players by using a random number generator
to simulate the players' "choices" (of rock, paper, or scissors). Review random numbers in section
3.9 in the text.
2.
3.
4. Make sure you "seed" the random number generator as shown in Program 3-25.
5. You will be printing out each game in the match and telling the score after each game. A match is
one or more games. Suppose the user entered that it will take 3 game wins to win the match. The
output would look similar to this:
game #1
playerl :
player2 : scissors
playerl
rock
= 1, player2 = 0
game #2
player 1
player 2
playerl = 1, player2 = 0
: рарer
: paper
Notice this game was a tie, so the
scores didn't change
game #3
player 1
player 2
playerl = 1, player2
: раper
: scissors
%3D
= 1
![game #4
player 1
player 2
playerl
Notice this game was a tie, so the
scores didn't change
: rock
:
rock
= 1, player2 = 1
game #5
player 1
player 2
playerl = 1, player2 = 2
:
rock
: paper
game #6
player 1
player 2
playerl = 1, player2
PLAYER2 WINS THE MATCH!
scissors
rock
= 3
6.
Because of possible ties, there is no way of knowing ahead of time how many games there will be.
7.
Please declare capitalized constants to stand for rock, paper, and scissors, and use these in your
program instead of hard-coded numbers.
Dlu Y](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F56e62b82-6189-4c1a-8a39-c4eca854fd80%2F3ab18701-e1f8-46c5-b2d9-4e3b4343d4b8%2Fjavnfxn_processed.jpeg&w=3840&q=75)
Transcribed Image Text:game #4
player 1
player 2
playerl
Notice this game was a tie, so the
scores didn't change
: rock
:
rock
= 1, player2 = 1
game #5
player 1
player 2
playerl = 1, player2 = 2
:
rock
: paper
game #6
player 1
player 2
playerl = 1, player2
PLAYER2 WINS THE MATCH!
scissors
rock
= 3
6.
Because of possible ties, there is no way of knowing ahead of time how many games there will be.
7.
Please declare capitalized constants to stand for rock, paper, and scissors, and use these in your
program instead of hard-coded numbers.
Dlu Y
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education