Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Program Description Write a program that plays the game of Rock, Paper, Scissors, Lizard, Spock. Your program should use defensive programming techniques. This means
C++ Program
Description Write a program that plays the game of "Rock, Paper, Scissors, Lizard, Spock". Your program should use defensive programming" techniques. This means your program should check any input provided by the user for errors and deal with unexpected values. Such programs will typically ask the user to reenter the requested value when the user enters inappropriate input. Your program should be written to break the program into functions that perform each major task. There should be at least three functions in addition to the main() function. The program should work as follows... When the program begins, it should generate a random number in the range of 1 through 5 (without telling the user what it has chosen) If the number is 1 then the computer has chosen "rock". If the number is 2 then the computer has chosen "paper" If the number is 3 then the computer has chosen "scissors". If the number is 4 then the computer has chosen "lizard" If the number is 5 then the computer has chosen "spock", The user then selects his or her choice using the keyboard. You can use a menu that asks the user to select a number or letter corresponding to one of the options. Alternatively, you can ask the user to type in the complete option. If you require the user to type in the complete option, you must ensure your program is case insensitive The computer's choice is then displayed The computer then displays the winner of the game, according the following rules: Scissors beats paper Paper beats rock Rock beats lizard Lizard beats spock Spock beats scissorsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started