Page 161 - Computer
P. 161

Item           Keyword                            Description

             5      COMPUTE,                   This is used to calculate the  results of an
                    CALCULATE or               expression                                        Computer Science
                     DETERMINE
        FOR ONLINE READING ONLY
             6      SET                        It is used to initialise values or assign a value
                                               to a variable
             7      INCREMENT                  It is used when you want to increase the value
                                               of a variable by one
             8      DECREMENT                  This keyword is meant to reduce the value of
                                               a variable by one.
             9      END                        Used to indicate the endpoint of the program
                                               or a process


            Rules for writing pseudocode                (iv)  Show  indentation  for the
              (i)  Only one statement should be written       pseudocode.  For example,  the
                 for each line, where each statement          pseudocodes  used  to  find  the
                 should represent a single action.            minimum of the two numbers,
              (ii) The input, output, and process             can be indicated as follows.
                 statements must be clearly stated
                 using standard keywords, such as                BEGIN
                 READ, PRINT, WRITE, DISPLAY,                           READ num1, num2
                 and RETURN. For example,                            If (num1<num2)

                           START                                           SET Min=num1
                                  READ a, b, c                       Else
                                  c = a+b                                          SET Min=num2
                                  PRINT c
                            END                                          PRINT Min
              (iii) Each initial keyword should                  END
                 be capitalised. For example,
                 pseudocodes are used to calculate       (v)  Pseudocode  should clearly
                 the area of a triangle.                      show the start and end of exe-

                    START                                     cutable statements and control
                           READ base, height, area            structures.
                           COMPUTE:                      (vi)  The statements should be short,
                            area=0.5*base*height              clear, and readable.
                           PRINT area
                    END

                                                  153
              Student’s Book  Form One
   156   157   158   159   160   161   162   163   164   165   166