Question: Please code in C! Create a program using C that will emulate various simple games. The program will code for a player who will play

Please code in C!

Please code in C! Create a program using C that will emulatevarious simple games. The program will code for a player who will

Create a program using C that will emulate various simple games. The program will code for a player who will play against a simulated opponent. The name of the opponent will be generated from a provided text file with 100 random names (sampleNames.txt). The opponent name will be selected by generating a random number between 0 and the 100 in the file and reading that number name in the file (Ex. If the code randomly generates 10 it would read and skip 9 names and store the name as the opponent's name) **Coding Tip: create a character array size 10 to fit any name: char name [10]; The player will be prompted to choose how many rounds they wish to play (Note: the input MUST be odd so that a winner can be selected). Present an error message and loop the question if the user enters an even or negative number. Welcome! I am your opponent (**generated from text file provided**) How many rounds would you like to play? (choose an odd number) --- After Game #1 --- The score is: Player: 1 (opponent name) : 0 After choosing the number of rounds the player will play a random set of games. Between each game show the player's and opponent's scores. After each game the next game should be randomly selected (Note: this means the player can play duplicate games and sometimes the same game back to back). Game #1: Number Guessing Game Write a function that has the opponent think of a number between two values. The two values should be at least 30 digits apart, but no greater than 100. The player will have 5 guesses and should receive feedback if the input value is higher or lower. Sample Output: Number Guessing Game! Player I'm thinking of a number between 250 and 350! You have 5 guesses! What's guess #1? 300 My number is lower! What's guess #2? Game #2: Rock, Paper, Scissors Write a function to play rock, paper, scissors where the opponent will pick a random throw. Use a simple integer driven menu and make sure to loop the menu on an invalid input. Paper beats Rock Rock beats Scissors Scissors beats Paper Print the winner. Sample Output: Rock, Paper, Scissors Game! Choose a throw! 1. Rock 2. Paper 3. Scissors >> Player wins the round! Game #3: Odds or Evens Write a function where the opponent will give a random number. Add the two numbers. If the total's oddness/evenness matches the player's guess - then the player wins (You may restrict the number choices to be within 0 and 5). Sample Output: Odd/Even Game! Guess even or odd! (0 for even, 1 for odd): 1 Enter a number (between 0 and 100): 25 (opponent name) picked 59 25+59 = 84 - EVEN! __ (opponent name) wins the round! If the player or opponent has a majority of victories end the game: victory = (# of rounds + 1) / 2 **Coding Tip: use function int RandomInRange (int min, int max) to generate a random number within a range Create a program using C that will emulate various simple games. The program will code for a player who will play against a simulated opponent. The name of the opponent will be generated from a provided text file with 100 random names (sampleNames.txt). The opponent name will be selected by generating a random number between 0 and the 100 in the file and reading that number name in the file (Ex. If the code randomly generates 10 it would read and skip 9 names and store the name as the opponent's name) **Coding Tip: create a character array size 10 to fit any name: char name [10]; The player will be prompted to choose how many rounds they wish to play (Note: the input MUST be odd so that a winner can be selected). Present an error message and loop the question if the user enters an even or negative number. Welcome! I am your opponent (**generated from text file provided**) How many rounds would you like to play? (choose an odd number) --- After Game #1 --- The score is: Player: 1 (opponent name) : 0 After choosing the number of rounds the player will play a random set of games. Between each game show the player's and opponent's scores. After each game the next game should be randomly selected (Note: this means the player can play duplicate games and sometimes the same game back to back). Game #1: Number Guessing Game Write a function that has the opponent think of a number between two values. The two values should be at least 30 digits apart, but no greater than 100. The player will have 5 guesses and should receive feedback if the input value is higher or lower. Sample Output: Number Guessing Game! Player I'm thinking of a number between 250 and 350! You have 5 guesses! What's guess #1? 300 My number is lower! What's guess #2? Game #2: Rock, Paper, Scissors Write a function to play rock, paper, scissors where the opponent will pick a random throw. Use a simple integer driven menu and make sure to loop the menu on an invalid input. Paper beats Rock Rock beats Scissors Scissors beats Paper Print the winner. Sample Output: Rock, Paper, Scissors Game! Choose a throw! 1. Rock 2. Paper 3. Scissors >> Player wins the round! Game #3: Odds or Evens Write a function where the opponent will give a random number. Add the two numbers. If the total's oddness/evenness matches the player's guess - then the player wins (You may restrict the number choices to be within 0 and 5). Sample Output: Odd/Even Game! Guess even or odd! (0 for even, 1 for odd): 1 Enter a number (between 0 and 100): 25 (opponent name) picked 59 25+59 = 84 - EVEN! __ (opponent name) wins the round! If the player or opponent has a majority of victories end the game: victory = (# of rounds + 1) / 2 **Coding Tip: use function int RandomInRange (int min, int max) to generate a random number within a range

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!