Question
Create a project called Daily11. Add a C source file to the project named daily11.c. Write a program to score the paper-rock-scissors game. Each of
Create a project called Daily11. Add a C source file to the project named daily11.c. Write a program to score the paper-rock-scissors game. Each of two players enters either P, R, or S. The program then announces the winner as well as the basis for determining the winner: Paper covers rock, Rock breaks scissors, Scissors cut paper, or Draw, nobody wins. The players must be able to enter either upper- or lower-case letters. If an invalid choice is entered, the player should be permitted to re-enter his choice immediately (before the other player is given a chance to enter their value). The program must allow the players to continue playing as long as desired by asking them after each game if they would like to play again.
For this assignment you MUST use a function to get the input value for the players choice. The function MUST return an enumerated type called Choice that has three values, ROCK, PAPER, and SCISSORS. This makes it so that the only part of your program that pertains to the player choices that can involve character variables is the input portion. The rest of your program should always use variables of the enumerated Choice type and the end result should be that your program is easier to read.
Your program output should look something like the following:
it is your turn ayer Please enter yourchoice (p)aper, (r)ock, or (s)cissors why I'm sorry, I do not understand Please enter yourchoice (p)aper, (r)ock, or (s)cissors: 42 I'm sorry, I do not understand Please enter your choice (p)aper, (r)ock, or (s cissors: Paper Player-2 it is your turn! Please enter your choice (p)aper, (r)ock, or (s)cissors: r Player-1 wins! Paper covers rock Do you wish to continue? (y): y Player-1 it is your turn! Please enter your choice (p)aper, (r)ock, or (s cissors: s Player-2 it is your turn! Please enter your choice (p)aper, (r)ock, or (s cissors: ROCK on! Player-2 wins! Rock breaks scissors Do you wish to cont inue? (y): n Press any key to continue - 2Step 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