Page 61 -
P. 61

another guess














                                        Why do I have to keep
                                        rerunning the program?
                                        You mean I only get one
                                        guess?????



                                         The users still don’t like it.
                                         The program works, and now generates extra feedback, but
                                          there’s a problem. If the users want to have another guess, they
                                          have to run the program again. They really want the program
                                          to keep asking them for another guess until they finally get the
                                          correct answer.
                                          Can you see what the problem is?
                                          How do we get the computer to do something repeatedly? Should
                                          we just make a copy of the code and paste it at the end of the file?
                                         That would make sure the user is asked twice. But what if they
                                          need to make 3 guesses? Or 4 guesses? Or 10,000 guesses?
                                         What about the case where the guess is correct?


                                         The guessing game program needs to be able to
                                          run some code repeatedly.
























           26    Chapter 1
   56   57   58   59   60   61   62   63   64   65   66