1
Again with the Number-Guessing
source link: http://programmingbydoing.com/a/again-with-the-number-guessing.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Again with the Number-Guessing
- Author: Graham Mitchell
- Filename: AgainWithTheNumberGuessing.java
Again with the Number-Guessing
Redo the Number-Guessing with a Counter
assignment using a do-while
loop instead
of a while
loop. Otherwise it should do exactly the
same things (including the counter).
Make sure that it doesn't mess up if you guess it on the first try.
I have chosen a number between 1 and 10. Try to guess it. Your guess: 5 That is incorrect. Guess again. Your guess: 4 That is incorrect. Guess again. Your guess: 8 That is incorrect. Guess again. Your guess: 6 That's right! You're a good guesser. It only took you 4 tries.
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK