Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

image text in transcribed

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

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

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

Time vs. Acceleration Y 0.0005 -0.001 0.0015 -0.002 0.0025

Answered: 1 week ago