Pure Programmer
Blue Matrix

Cluster Map

Project: Number Guessing Game

Write a program that allows the user to play a number guessing game. The program should ask the user for the maximum number available to select. Then the program should select a number between 1 and the maximum, inclusive, at random. The program will then enter a loop allowing the user to make guesses and will display whether that guess is high, low or correct. Once the user has guessed the correct number, the program should print the number of attempts it took to guess the number.

$ g++ -std=c++11 NumberGuessingGame.cpp -o NumberGuessingGame -lfmt $ ./NumberGuessingGame Maximum for value: 16 Try to guess the number I'm thinking of between 1 and 16 Guess #1: 8 Your guess is too high. Guess #2: abc Your input makes no sense to me! Guess #2: 4 Your guess is too low. Guess #3: 6 Your guess is too high. Guess #4: 5 You guessed my number in 4 attempts!