Page 253 -
P. 253

game show pseudo-code




                                                You were asked to use the space provided below to write the
                                                pseudo-code for the program you’ve been asked to write for TVN:

                                        number_asked = 0
             You need to remember how
             many questions were asked,   number_correct = 0
             how many were correct,
             and how many were wrong.   number_wrong = 0




                 Begin by asking the    ask the host to press 1 for correct, 2 for incorrect, or 0 to end
                 host to make a choice.  while the host response is not 0

                                            if host response was 1

                                                add 1 to number_asked
            This will run if the question           add 1 to number_correct
            was answered CORRECTLY.
                                                play a sound effect

                                            if host response was 2

                    This will run               add 1 to number_asked
                     if the question            add 1 to number_wrong
                     was answered
                     INCORRECTLY.               play a sound effect


                 Ask the host at the       ask the host to press 1 for correct, 2 for incorrect, or 0 to end
                 end of each loop what
                 he wants to do next.

                      Finally, display   display the values of number_asked, number_correct and
                      the scores.       number_wrong on screen


             Don’t worry if your answer
             doesn’t look EXACTLY like
             this. There are a few ways
             of writing the code.








           218    Chapter 7
   248   249   250   251   252   253   254   255   256   257   258