Question: Rock Paper Scissors Function Write a function that will return Rock, Paper or Scissors. It will use the random number generator to generate a number

 Rock Paper Scissors Function Write a function that will return Rock,Paper or Scissors. It will use the random number generator to generatea number between 0 and 2 and will return a value as

Rock Paper Scissors Function Write a function that will return Rock, Paper or Scissors. It will use the random number generator to generate a number between 0 and 2 and will return a value as follows: Assume that the srand function has already been invoked by the main function (see below) Play game of Rock Paper Scissors Write a program that will let two players play the game of Rock Paper Scissors. It will have a main function and the Rock Paper Scissors function. The main function will perform the following tasks: 1. It will invoke the srand function. 2. It will ask the name of the first player and save it in a variable named player1. 3. It will ask the name of the second player and save the name in a variable named player2. 4. It will use the Rock Paper Scissors function to generate an outcome for the first player. 5. It will announce the out come with the player's name. Example: "David got a rock." 6. It will use the Rock Paper Scissors function to generate an outcome for the second player. 7. It will announce the out come with the player's name. Example: "Jack got a paper." 8. It will announce the winner of the game. Example: "Jack is the winner as paper covers the rock" 9. It will ask the user if they want to play again. If the answer is yes then it will repeat steps 4,5,6,7, and 8 . If the answer is no then it will exit. Winner of the game will be determined as follows: Rock beats the scissors as rock breaks scissors. Paper will beat rock as paper covers the rock. Scissors will beat paper as scissors cuts paper. If the outcome for both player is same then it will be tie and the program will announce that the game is a tie

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!