QBasic Tutorial 14 - Guess My Number Guessing Game - QB64

SchoolFreeware
SchoolFreeware
31.4 هزار بار بازدید - 13 سال پیش -
http://www.SchoolFreeware.com

We will make the classic game Guess My Number. It is a very boring game to play, by today's standards, but programing the game can be interesting.

These are the requirements of the game:

The program will prompt the user to select one of three games. The games are 1-10, 1-100, 1-1000. If the user does not enter the right selection, the program will display the selection again. Once the user selects the game, the program will randomize the number and prompt the user for a guess. The guess will be checked with the computer's number. If the guess was not correct, the computer will prompt the user to guess higher or lower. If the guess was correct, the computer will display the number of times the user guessed, and the game will be over. The computer will prompt the user to play again. If the user does want to play again, the program will return to the game menu. If the user does not want to play again, the computer will quit the program.

Before we get to the code, there is a built-in function called UCASE$. UCASE$ converts the text to uppercase. UCASE$ is used to prevent the program from being case sensitive. The computer sees "A" differently than "a". By converting the case, the user can enter both lower and uppercase answers and the computer will respond to the input the same way.
13 سال پیش در تاریخ 1390/05/11 منتشر شده است.
31,464 بـار بازدید شده
... بیشتر