Home > Back-end >  Programming, wrote a few is right or not, ask bosses help
Programming, wrote a few is right or not, ask bosses help

Time:10-09

Classic, guess the Numbers, the program randomly generates a number between 0 and 100, allow users to guess each
User after speculation, update tip number range, and the program should limit the user to guess the number, by making
The user to select difficulty confirmation number limit, simple difficulty 10 times, normal difficulty eight times, difficult difficult 5 times,
Hell difficulty 3 times,
Procedures shall strictly comply with the following example, the green font for user input
* * * * * * * * guess Numbers game * * * * * * * *
You can within a limited opportunity to a 0-100 scale digital kitchen knife?
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
(please select a difficulty (simple [S] [N]/[D]/[H]) hell difficulty: S
Simple is difficult, you have 10 times opportunity

The first guess: the number between 0-100: 50
Guess wrong! The number is less than 50

The second guess, the number between 0 and 49: and
Guess wrong! The number is less than 26

Guess for the third time, the number between 0 and 25: 13
Guess wrong! The number is less than 13

Fourth is forecasted, the number between 0-12: 13
Invalid input! Please enter a number between 0 and 12

Fourth is forecasted, the number between 0-12: 6
Guess wrong! The number is greater than 6

Fifth is forecasted, the number between 7-12: 5
Invalid input! Please enter a number between 7 to 12

Fifth is forecasted, the number between 7-12: 10
Guess wrong! The number is less than 10

Sixth is forecasted, the number between 7-9:
Guess wrong! The number is greater than 8

Guess, for the seventh time the number between 9-9: 9
Congratulations to you! After seven times try, finally guessed right!

* * * * * * * * guess Numbers game * * * * * * * *
You can within a limited opportunity to a 0-100 scale digital kitchen knife?
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
(please select a difficulty (simple [S] [N]/[D]/[H]) hell difficulty: H
Hell difficulty, you have three chances to

Guess the first time, the number between 0-100: 80
Guess wrong! The number is less than 80

The second guess, the number between 0-79: 60
Guess wrong! The number is greater than 60

Guess for the third time, the number between 61-79: 66
Guess wrong! The number is larger than 66
Very sorry! Your chance to run out!

CodePudding user response:

https://blog.csdn.net/qq_45861670/article/details/104062908

Mew: ahaha

Good coincidence, I have written a simple version, nong can see

CodePudding user response:

Young man, wrote a question for you, another question to answer no separate post again?

CodePudding user response:

refer to the second floor paullbm response:
, young man wrote a question for you, another question to answer no separate post again?
my writing, my friend want me to help him write a, but you can't, and I can only ask for help