Rules for rock, paper, scissors: rock beats scissors, paper beats rock, scissors
ID: 3643577 • Letter: R
Question
Rules for rock, paper, scissors: rock beats scissors, paper beats rock, scissors beats paper.Write a while loop. Each time it runs, it asks player 1 to enter R, P, or S (for rock, paper or scissors), then asks player 2 the same thing. Declare a winner for the game and ask player 1 if she wants to play again. If input is Y, then run the loop again, else, exit the loop. After the loop, display how many games each player won and declare which player won the most games, or if it was a tie. Note: do not ask players for their names; simply refer to
Explanation / Answer
The reason why it doesn't compile is because you need to define the following functions: void gameResult(objectType play1, objectType play2, int& winner); void displayRules(); void displayResults(int gCount, int wCount1, int wCount2); objectType retrievePlay(char selection); bool validSelection(char selection);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.