/NumberGame

Number guessing game: Guess a random number between 1 and 100 in limited attempts.

Primary LanguageC++

Number Guessing Game

This is a simple number guessing game implemented in C++ where the player tries to guess a randomly generated number between 1 and 100 within a limited number of attempts.

How to Play

  1. Upon running the program, the player is welcomed and informed that a random number between 1 and 100 has been selected.
  2. The player is provided with hints about the nature of the secret number (even or odd).
  3. The player is prompted to enter their guess.
  4. If the input is invalid (not a number between 1 and 100), an error message is displayed, and the player is prompted to enter a valid guess.
  5. After each guess, the program provides feedback whether the guess is too high or too low, along with hints about the proximity to the secret number.
  6. The game continues until the player correctly guesses the number or runs out of attempts.
  7. If the player runs out of attempts, the correct number is revealed.

Features

  • Randomly generated secret number between 1 and 100.
  • Maximum of 7 attempts allowed.
  • Hints about whether the secret number is even or odd.
  • Feedback on the proximity of the guessed number to the secret number.
  • Input validation for ensuring the entered number is within the valid range.

How to Run

  1. Clone the repository.
  2. Compile the code using a C++ compiler.
  3. Execute the compiled binary.

Acknowledgments

  • This program is inspired by classic number guessing games.
  • Special thanks to the C++ community for helpful resources and discussions.