Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this homework you are asked to implement, in a single-file C program, a Guess the number game that works as follows. The computer chooses

image text in transcribed

In this homework you are asked to implement, in a single-file C program, a "Guess the number game" that works as follows. The computer chooses a random value between 1 and 100 let us call this value r) The human player inputs some value u into the program to guess the number The computer prints messages to tell the human whether his number u is smaller or greater than r The human player has only 5 tries to find the number, if he does not find it he loses. Recommendations for your C source code (these will impact your grade) Your code should compile with gcc-Wall without warning Only use local variables, no local variables at all Variables names shall start with non- capital letters. Constants name should be all capital letters. The Crandom number generator should be properly initialized and used. If you feel confident, you are encouraged to add new features or checks to your program (for instance, if the player inputs some number outside of the 1-100 range, you may decide it is an error and not count it as a real try, etc.) Remember that your code will be read by someone else, so make it clean and tidy, use indentation so that vertical alignment corresponds to depth of code blocks. You may define some function(s) apart for the main function of your program, but it is not obligatory. Recommendations for your C source code (these will impact your grade) . Your code should compile with gcc - Wall without warning Only use local variables, no local variables at all Variables names shall start with non- capital letters. Constants name should be all capital letters. The Crandom number generator should be properly initialized and used. If you feel confident, you are encouraged to add new features or checks to your program (for instance, if the player inputs some number outside of the 1-100 range, you may decide it is an error and not count it as a real try, etc.) Remember that your code will be read by someone else, so make it clean and tidy, use indentation so that vertical alignment corresponds to depth of code blocks. . You may define some function(s) apart for the main function of your program, but it is not obligatory

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions