A simple console-based number guessing game written in C++. The program generates a random number between 1 and 100, and the player must guess it with the help of hints.
- Random number generation
- User input validation
- Hint system (Too high / Too low / Close / Very close)
- Tracks number of attempts
- Option to play multiple rounds
- Console-based interactive gameplay
-
C++
-
Standard Library:
iostreamcstdlibctimecmathlimits
git clone https://github.com/RohanRathodOnline/GuessingGame.git
cd GuessingGame
g++ Guessing_Game.cpp -o game
./game
- The program generates a random number between 1 and 100.
- The player enters guesses.
- The program provides hints:
- Too high – Guess a smaller number
- Too low – Guess a bigger number
- Close – You are near the correct number
- Very close – Almost correct
- The game continues until the correct number is guessed.
- The total number of attempts is displayed.
- The player can choose to play again.
=====================================
= NUMBER GUESSING GAME =
=====================================
I have generated a number between 1 and 100.
Try to guess it!
Enter your guess: 50
Too low! Try again.
Enter your guess: 75
Close! Try a smaller number.
Enter your guess: 63
Correct! You guessed it in 3 attempts.
GuessingGame
│
├── Guessing_Game.cpp
└── README.md
- Add difficulty levels (Easy / Medium / Hard)
- Limit the number of attempts
- Add a scoring system
- Create a graphical version of the game
Rohan Rathod