Write a program that allows the user to play guessing games. A guessing game is where the computer generates a random number and the user tries to guess it. The program loops until the user guesses the random number, or enters a sentinel value to give up. After five wrong guesses, the user is given help (higher or lower messages). After a game has been completed, the program asks the user if they want to play again. The user is allowed to play at most 256 games. Prior to terminating program, print the following. number of games played number of games won winning percentage At the end of your program should be a comment block that contains the pseudo-code for your program. This program must be split into at least three functions. Required Manifest Constants Your program must define the following manifest constants prior to the definition of the main() function (i.e. make these global): const int MIN_NUMBER = 1; const int MAX_NUMBER = 100; const int EXIT_VALUE = -1; const int MAX_GAMES = 256; Generating a Random Number Include the time.h header file. To generate a random number that ranges between MIN_NUMBER and MAX_NUMBER (inclusive), use code similar to the following: srand(time(NULL)); randomNumber = MIN_NUMBER + rand() % (MAX_NUMBER - MIN_NUMBER + 1); The time() function returns the current date and time in seconds since 01-Jan-1970 00:00:00 GMT. Passing this return value to srand() "seeds" the random number generator so that a different set of random numbers are generated every time the program is executed. The rand() function returns a random number between 0 and RAND_MAX (a manifest constant defined in stdlib.h).
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Example Game: Assume the computer generated random number is 34 for game #1, 73 for game #2, and 99 for game #3. For example purposes, user inputs are enclosed in brackets <>. *** You are playing the CIS162 Guessing Game *** Enter a number between 1 and 100 (-1 to give up): <3> nope... Enter a number between 1 and 100 (-1 to give up): <1001> 1001 is too big... Enter a number between 1 and 100 (-1 to give up): <0> 0 is too small... Enter a number between 1 and 100 (-1 to give up): <33> nope... Enter a number between 1 and 100 (-1 to give up): <50> nope... Enter a number between 1 and 100 (-1 to give up): <21> nope... Enter a number between 1 and 100 (-1 to give up): <41> nope... Enter a number between 1 and 100 (-1 to give up): <27> nope...higher Enter a number between 1 and 100 (-1 to give up): <57> nope...lower Enter a number between 1 and 100 (-1 to give up): <34> *** GOT IT *** it took you 8 guesses Do you want to play again? (y/n): Enter a number between 1 and 100 (-1 to give up): <99> nope... Enter a number between 1 and 100 (-1 to give up): <-1> *** QUITTER *** Do you want to play again? (y/n): Enter a number between 1 and 100 (-1 to give up): <21> nope... Enter a number between 1 and 100 (-1 to give up): <99> *** GOT IT *** it took you 2 guesses Do you want to play again? (y/n): Thanks for playing the CIS162 guessing game. You played 3 games and won 2 of them. Your winning percentage is 66.7%.
## Platform
Windows XP