What I do in this homework is to guess the number game. The role of this program: using a computer to generate a random number within 100, the game to guess the number, guess is winning, guessing, the hint is big or small, continue to guess until the right to guess. At the end of the game, the comment is given and the number of times the player uses and guesses is calculated.
How to execute the program: Click the "Get Random Number" button and the system gets a random number. Players enter a number, if the player entered a number than the system given a small number of random, the system will prompt "you guessed too small, please continue to guess!" ”。 If the player enters a number that is larger than the random number given by the system, the system prompts you to guess too much, keep guessing! ”。 If the player guesses the number, but the time is more than 10 seconds, the system will prompt "so long to guess, a bit stupid!" and calculates the time and number of guesses the player has taken. If the player guesses the number, and the time is less than 10 seconds, the system will prompt "Congratulations, guess right!" You're awesome, you have a really high IQ! and calculates the time and number of guesses the player has taken.
of the program:
Experience:
I have gained a lot in this experiment.
There has been a lot of learning from this experiment. For example: for (; The {} function is fantastic. Do not realize the way to achieve the function, it can be achieved! In addition to this one, some other functions have also been consolidated. It was always vague, and now my heart is clear.
Peacetime learning itself only notice the knowledge of the book above, some of the use of classes and methods appear only, this study let me from an armchair gradually transition to practice out of truth. Finally can design their own programs, the previous sense of learning are not used, now only know the use of the previous learning is really big, want to learn programming is indispensable. Previously felt, programming is how mysterious, now through their own practice, just know, programming is not so mysterious, but it is very fun. The feeling that you see yourself programmed to run the results is beyond words. Therefore, I suggest that in the future, a number of experiments in this area, there is a chance to challenge themselves.
The link to the program in GitHub is: Guess the number game https://github.com/mengmengda123/text/blob/master/%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%BD%9C%E4% B8%9a%e4%b8%aa%e4%ba%ba%e9%a1%b9%e7%9b%ae
Second homework, guess number games