Question
In C language programming: Please create a simple guessing number game that gives the user 5 tries at getting the right number. The range should
In C language programming:
Please create a simple guessing number game that gives the user 5 tries at getting the right number. The range should be 1 through 20. The program should first ask the user if they want to play. Have them type 'Y' to play or 'N' to quit if they don't want to play. If they enter "N" the game ends, If they enter 'Y', give them 5 tries to guess the right number. Each try should let them know if the input was too high or too low. If they guess the right number in less than 5 tries, display a "YOU WIN" message otherwise a "YOU LOSE" if they fail run out of tries.
You should use if/else statements, defined constants, use random number generator and seeding. Use functions accordingly and passing by value and reference. Use format control strings to format text output. Use libraries: #include , #include , #include .
Do NOT use global variables other than a defined constant
Do NOT use the exit() statement
Do NOT mix local declarations and local statements in functions
Example of Output below:
Example of not wanting to play: Do you want to play a random number guessing name? Enter in a 'y' for yes and a 'n' for no: 0 You did not want to play or entered an invalid choice. Example of playing and winning: Do you want to play a random number guessing game? Enter in a 'y' for yes and a 'n' for no: y The number is from 1 to 20. Can you guess what it is? 1 Your guess of 1 is too low. Can you guess what it is? 19 Your guess of 19 is too high. Can you guess what it is? 5 Congrats, you wonStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started