Guessing Game

Closed

Description

This assignment requires the use of random numbers. You must include the <cstdlib> and <ctime> header files to allow access to rand() and srand(), respectively. These will be discussed in class. The program will implement a “guessing game.?? Ask the user for a number in the range of 1 through 100, inclusive. If the guess is larger than the random number you generated in the range of 1 through 100, inform the user that the guess was too high. If the guess is too low, say so, and when the guess matches the random number, say so! Also, tell the user how many guesses were required. What should you do if the user inputs an invalid guess? Suppose the user enters 0 or 200? You should allow only valid guesses. Therefore, keep asking for guesses until the user enters a number between 1 and 100, inclusive. Run the program 3 times and print the results (note: be sure to use some invalid guesses to test that part of your logic). Remember to print an error message (with the number) when an invalid guess is made. Code a function named, guess(), that will return a number in the range 1 to 100, inclusive. As discussed in class, the function, rand(), will return a random number in the range 0 to MAX, where MAX is a predefined constant (maybe 32767, or ??). Obviously, you must modify the random number to be in the range from 1 to 100, inclusive. Also, random numbers are generated using “seed?? values. Unless you change the seed each time the program is executed, the program will generate the same sequence of random numbers. This makes the game trivial once the user realizes that the random numbers are always the same! To avoid this problem, use srand() to “seed?? the random number generator. You use srand() only once in your program (not in a loop!) to change the seed value. This will cause the program to generate a different sequence of random numbers each time the program is executed! The exact function invocation is:

srand(time(NULL)); //use the system clock to generate a seed

Code the program to allow the user to play the game multiple times and display the average number of guesses at the end of the game. Suppose the user played the game 5 times and the number of guesses for each game was: 7, 4, 5, 5, and 8. The average number of guesses would be: 5.80. Also, allow the user to enter either an uppercase Y or a lowercase y to continue with another game!

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):

a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.

b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

## Platform

Must be written in Microsoft Visual c++

Windows 2000

Skills: C Programming, Engineering, MySQL, PHP, Software Architecture, Software Testing

See more: use srand makes program work, 100 guessing game, windows game programming, what is game programming, what is an assignment problem, what is a loop in programming, what is a class in programming, web game programming, test code generator, rand c programming, programming with game, programming what is a class, programming loop, max programming hire, loop programming, hire game programming, hire game code, hire a coder for your game, generator logic, game coder for hire, c test generator, cstdlib, c programming random number, c programming rand, c generate random number in range

Project ID: #3155018

Awarded to:

letregrandecoder

See private message.

$17 USD in 4 days
(38 Reviews)
4.7

36 freelancers are bidding on average $13 for this job

amunsol

See private message.

$8.5 USD in 4 days
(94 Reviews)
6.9
vwsolutionsvw

See private message.

$4.25 USD in 4 days
(10 Reviews)
6.5
softdesignervw

See private message.

$25.5 USD in 4 days
(23 Reviews)
6.3
hasnut

See private message.

$17 USD in 4 days
(144 Reviews)
6.3
DanD

See private message.

$12.75 USD in 4 days
(207 Reviews)
5.8
dancristoloveanu

See private message.

$17 USD in 4 days
(37 Reviews)
5.7
vw542790vw

See private message.

$12.75 USD in 4 days
(64 Reviews)
5.5
coderhere

See private message.

$17 USD in 4 days
(28 Reviews)
5.1
vangelisdimou

See private message.

$21.25 USD in 4 days
(61 Reviews)
5.1
lmxvw

See private message.

$16.15 USD in 4 days
(125 Reviews)
4.6
bunts007

See private message.

$17 USD in 4 days
(47 Reviews)
4.6
vw945703vw

See private message.

$25.5 USD in 4 days
(22 Reviews)
4.2
exceptionalcoder

See private message.

$21.25 USD in 4 days
(9 Reviews)
4.1
starlightsoft

See private message.

$17 USD in 4 days
(10 Reviews)
4.1
gworroll

See private message.

$12.75 USD in 4 days
(42 Reviews)
3.7
aditsu

See private message.

$12.75 USD in 4 days
(9 Reviews)
3.5
vw627017vw

See private message.

$8.5 USD in 4 days
(23 Reviews)
3.5
thextvw

See private message.

$8.5 USD in 4 days
(42 Reviews)
3.4
nsmith100

See private message.

$6.8 USD in 4 days
(15 Reviews)
3.3
karsazsoft

See private message.

$6.8 USD in 4 days
(15 Reviews)
3.1