As part of an introductory programming course, I created an interactive guessing game in C++. The game generates a random number that the player tries to guess in as few attempts as possible.
During development, I focused on implementing algorithms for generating random numbers and efficiently processing user input. This project helped me deepen my knowledge of conditional statements and loops.

Instructions:
Develop a C++ application, limited to 100 lines of code, that utilizes basic input/output operations to perform a simple function.
This challenge is designed to test your foundational knowledge of C++ programming. You’ll be tasked with creating a concise and efficient application that demonstrates your understanding of input/output operations, control flow, and basic data structures.
- Programming Language: C++
- Development Environment: Visual Studio
Input/Output Operations in the C++ Code
In the provided C++ code, the input/output operations are primarily handled using the library – iostream.
INPUT
User’s guess: The program prompts users to enter a number between 1 and 100.
Random number: The program generates a random number using the function and stores it in the variable.
OUTPUT
The program displays various messages to guide the user, such as:
“Guess, Which number I think? (between 1 and 100): “
“Invalid input! Please enter a number between 1 and 100: “
“My number is smaller. Guess again: “
“My number is bigger. Guess again: “
At the beginning of the game, the computer randomly selects a whole number within a predetermined range. This number remains hidden, and the player’s task is to guess it. The player enters their first guess, and the computer informs them whether their guess is higher or lower than the secret number.
Reflection
While creating a guessing game in C++, I realized how important careful preparation and planning are. First, I had to clarify what functions the game would have and what its basic algorithm would be. Then I focused on implementing individual parts of the code.
During development, I encountered several problems that I had to solve, for example, with generating random numbers or handling incorrect input. Thanks to this project, I improved my logical thinking and problem-solving skills.