Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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 won

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

Be familiar with the integrative servicescape model.

Answered: 1 week ago

Question

Understand the role of corporate design in communications.

Answered: 1 week ago