C++
PROJECT 2.3.1
Guess Number
For our projects, we will use the Microsoft Visual Studio application. It allows you to create projects in different programming languages and on different platforms. We guess you already have Visual Studio on your PC. If not, download and install Visual Studio on your Personal Computer from the next link:
Download Visual Studio >>>
If it is not Installed, we will need to download Extension "C++ Windows Forms for Visual Studio 2022 .NET Framework. Here are the instruction:
Open Visual Studio. Create any project. Click Extensions on the meniu panel. After Click manage Extensions. New window will open. In the search write C++ forms. Select "C++ Windows Forms for Visual Studio 2022 .NET Framework" from the list and click download.
After closing Visual Studio you will get the message. Click Modify  to install the extension.
Our Online Simulator will help you to make the game "Guess Number".
Now a little theory for our project:
1. Random numbers
To create a random generator we will use the next code:
srand(time(0));
int randomNum = rand() % 100+1;
textBox1->Text = Convert::ToString(randomNum);
Here, the first line is for getting the different numbers each time. Without this line, every time we run the code, we will get the same random numbers (it means they will not be truly random).
In the second line, we will specify random numbers ranges - from 1 to 100.
100 is for getting random numbers from 0 to 99. After adding +1 we will get random numbers from 1 to 100.
In thi third line we will put random number in text box. To put number in text box in C++, we have to convert it to string, so we are using Convert::ToString() before the variable - randomNum.
2. Message Box
Message Box Displays a message in a dialog box. We are using a simple Message Box in our project. Here is an example:
MessageBox.Show(" some text here ");