This assignment is to write a program to score the rock-paper-scissors game. Each of two players enters R, P, or S. The program than 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". Use nested if statements (or if-else-if) to do the homework. In this assignment, you will write two functions, getThrow and checkWinner. Your getThrow function will be given an int representing a player number to prompt and will ask that player to enter one of rock, paper, or scissors, repeating until they enter a valid input and returning a char representing the result. Your checkWinner function will be given two chars representing the throws of the two players and will print the results of the contest. Both functions must accept both upper and lowercase inputs. Your main function will call both functions to form a complete program. Remember that you can call a function multiple times. Your program will be tested for all possible combinations of two inputs. In C Programming
This assignment is to write a program to score the rock-paper-scissors game. Each of two players
enters R, P, or S. The program than 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". Use nested if statements (or if-else-if) to do the homework.
In this assignment, you will write two functions, getThrow and checkWinner. Your getThrow
function will be given an int representing a player number to prompt and will ask that player to
enter one of rock, paper, or scissors, repeating until they enter a valid input and returning a char
representing the result. Your checkWinner function will be given two chars representing the throws
of the two players and will print the results of the contest. Both functions must accept both upper
and lowercase inputs.
Your main function will call both functions to form a complete program. Remember that you
can call a function multiple times. Your program will be tested for all possible combinations of two
inputs.
In C
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images