Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please also show out put of the program created. Write a program that prompts the user (or Player 1 ) to input an integer value

Please also show out put of the program created.
image text in transcribed
Write a program that prompts the user (or "Player 1 ) to input an integer value between 1 and 3 (where 1=paper, 2=scissor, and 3= rock). This input should be passed into a string function called player_RPS(), and returns a string value indicating the selection of paper, scissors, or rock (as mentioned above). Next, the returned string value, along with a generated input from the computer, should be passed into a void function called RPS_comparison(), and determines whether the user's input or the computer's generated input is the winner or if both inputs result in a tie. This program should play this game ten consecutive times and call a function named winner_tally_to_file() to append the winner (either PLAYER1-WINS!!!, COMPUTER-WINS!!!, or TIE!!!) of each match to a text file called rps.txt. After the 10th match, this program should call a function named official_tally_from_file() to read the stored data from the rps.txt file back into the program, place this data into a 25 two-dimensional array, and print this data to screen after the array is traversed. While this data is being stored in the array, the program should tally the number wins for Player 1, Computer, and TIE, respectively, and output the entity with the most wins: Example: PLAYER 1 HAS THE MOST WINS IN THE TEN GAME SERIES THE COMPUTER HAS THE MOST WINS IN THE TEN GAME SERIES MAJORITY OF THE GAMES ENDED IN A TIE Code for creating the computer's generated input is provided below. This snippet of code can be placed into the main function: string computer_selection; srand(time (0)) ) int comp_selection = rand () o 3+1; if (comp_selection = 1) choice "paper"; ) else if (comp_selection =2 ) choice = "scissor"; ) else if (comp_selection =3 ) choice = "rock"; computer_selection = choice

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions