Question: Upload a . c source file containing a main function that will implement the following program. Your program will implement a text - based game
Upload a c source file containing a main function that will implement the following program. Your program will implement a textbased game that the user plays against the computer.
Both the player and the computer start with points.
During a round of the game, the player starts by entering an integer value. This value is normally between and included. However, since it is meant to be subtracted to the points that the player has, they cannot enter a value greater than the number of points they have left. For instance, if a player has only points left, then they can only enter a value between and instead of and
Once a valid value has been entered see below for how to handle invalid input the computer generates a random integer value, also between and either or whatever the number of points it has left is if it is below For instance, the computer has points left, they will generate a random number between and If they had only point left, they would have to generate a random number between and... well...
The winner of the round is whoever has entered the largest value. If both values are the same, then no one wins. When the player wins a round, their score is incremented by one starting at at the beginning of the game
As soon as either the computer or the player run out of points, the game ends and the player's score is displayed. The score is computed by adding the actual score to the number of points the player has left.
See the example of program's execution section below for more details about the requirements.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
