https://github.com/ROSSARKO/NumberGuessingGame
A simple console-based number guessing game written in modern C++ (C++20). The computer randomly chooses a number between 1 and 100, and the player tries to guess it with hints provided after each guess.
- Random number generation between 1 and 100
- User input with feedback: "too high" or "too low"
- Unlimited attempts until the correct guess
- Clean and beginner-friendly codebase
- C++20 compatible compiler (e.g. GCC 10+, Clang 11+, MSVC 2019+)
- CMake (optional, for cross-platform builds)
- Visual Studio 2022 or any modern C++ IDE
-
Clone the repository:
git clone https://github.com/ROSSARKO/NumberGuessingGame.git cd NumberGuessingGame -
Open
NumberGuessingGame.slnin Visual Studio 2022 -
Build the project:
Build -> Build Solution (Ctrl+Shift+B) -
Run without debugging:
Debug -> Start Without Debugging (Ctrl+F5)
CMakeLists.txt must be created manually (see below)
-
Clone the repository:
git clone https://github.com/ROSSARKO/NumberGuessingGame.git cd NumberGuessingGame -
Create a build directory and run CMake:
mkdir build cd build cmake .. cmake --build .
-
Run the program:
./NumberGuessingGame
Welcome to the Number Guessing Game!
I'm thinking of a number between 1 and 100. Can you guess it?
Enter your guess: 50
Too high!
Enter your guess: 25
Too low!
Enter your guess: 37
Congratulations! You guessed the number in 3 tries!
- GitHub: ROSSARKO
- Language: C++
This project is released under the MIT License.
You are free to use, modify, and distribute it for learning and non-commercial purposes.