Aug-14-2019, 11:21 AM
Starting with someone else's code is a bad idea, largely because you can't be sure of the logic he/she used to put it together. Suggest you start with mapping the flow and tasks of the program, like this:
1. Welcome note and get user name
2. Generate random integer, initiate counter
3. Start loop asking for guesses
4. If guess high give message, deduct 1 from counter. If counter > 0 go to 3, otherwise go to end block
5. If guess low give message, deduct 1 from counter. If counter > 0 go to 3, otherwise go to end block
6. If guess correct, give message and go to end block
7. <end block> Print game over, ask if wants to play again
8. if response is yes, go to 2, otherwise stop
OK so that is the basic blocking out of the tasks. Do each one, and you learn along the way.
1. Welcome note and get user name
2. Generate random integer, initiate counter
3. Start loop asking for guesses
4. If guess high give message, deduct 1 from counter. If counter > 0 go to 3, otherwise go to end block
5. If guess low give message, deduct 1 from counter. If counter > 0 go to 3, otherwise go to end block
6. If guess correct, give message and go to end block
7. <end block> Print game over, ask if wants to play again
8. if response is yes, go to 2, otherwise stop
OK so that is the basic blocking out of the tasks. Do each one, and you learn along the way.