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;
}
Expert Solution
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
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
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education