
Mathematically, in C or C++ we limit this by using modulo operator with %, for example rand()%100 means random number between 0-99. We can not change constant numbers or we must modify which is not recommended. RAND_MAX is maximum number that is a constant defined in.
To have a random number we will use rand() function which generates a number between 0 and RAND_MAX. If user can’t find it in all steps, the game will be over and computer will print the random number that hold. Each time the player enters a guess, the computer tells user whether the guess is too high, too low, or right, game will over. At the beginning our application will hold a random number, and it will ask for it. User should try to do as few attempts as possible. In this game the computer ( actually this is your application that you will develop) will choose a random number between 1 and 100, and the player will try to find this number in 10 steps. Guessing Game: Our game is about to guessing numbers between 1 and 100. If you are new to C++, you can easily start learning C++ with this game. This is very good example to show how user and computer acts as in inputs and outputs with the logic in code lines. Every beginner should learn to code Guessing Game, which is mostly classic in most of courses.
Terimakasih gan pantes ga mau jalan di dev c++. You can also create some small games in Dev-C++, you may need C++ Builder, VSCode, VS C++ to develop much more professional games. Membuat program stack sederhana dengan c++ beserta contoh program stack c++ sederhana, penjelasan kode setiap programnya dan Implementasi stack LIFO. The original developer is Bloodshed Software. Dev-C++ can be downloaded from Embarcadero’s site, Sourceforge, or Github.
If you want to develop professionally it is highly recommended you start with C++ Builder CE version. Embarcadero Dev-C++ is free, and is a fast, portable and simple C/C++ IDE for Windows.