Question: Computing 1 C programming Description: Create a project called Assgn5. Add a C source file to the project named assign5.c. Write a program to score
Description: Create a project called Assgn5. Add a C source file to the project named assign5.c. Write a program to score the paper-rock-scissors game AGAIN. 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. The primary differences betw this daily and Assgn2 are that (1) After you read the player's choice, you will need to convert it to an enumerated type value. The enumerated type should be called Choice that has three values, ROCK, PAPER, and SCISSORS. For example, if the user enters P' or 'p', you'll need to create a Choice type variable with a value PAPER, and use that new variable in your program later. 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. Also, remember to define the Choice type as a global name as we learned in the class. (2) Use switch statement to rewrite Assgn2. You may write the code entirely with switch case statement or the combination of switch statement with the nested if-else. Goal: to make your code more readable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
