Page 146 - Computer - 6
P. 146

(c)  Read( ): It reads string values as input.
            (d)  ReadNumber( ): It reads numeric values as input.

            (e)  Clear( ): It clears the output window of all text.
            Remember:
             •  To display a combination of string and numeric values in the output window, use a ‘ + ’ sign
                between the values. For example, Marks = 89

                TextWindow.Writeline(“Your marks are = ” + Marks)
             •  You  must  press  the  Enter  key  after  typing  the  required  text  or  number  for  the  Read(  )  and
                ReadNumber( ) methods to allow Small Basic to accept the input.

            Math Library Functions
            Small  Basic  provides  a  Math  Library  that  contains  various  functions  to  perform  calculations  in
            programs. Some of these functions are described in the table given below.
                      Function                         Explanation                             Example

                                          It compares two numbers and returns
             Math.Max(Num1, Num2)                                                   Math.Max(55, 68) = 68
                                          the greater of the two numbers.
                                          It compares two numbers and returns
             Math.Min(Num1, Num2)                                                   Math.Min(55, 68) = 55
                                          the smaller of the two numbers.

             Math.Pi                      It returns the value of pi (π).           Math.Pi = 3.14159265358979
                                          It returns an integer that is less than or
             Math.Floor(Num)                                                        Math.Floor(34.6) = 34
                                          equal to the specified decimal number.
                                          It returns  the remainder when  the
             Math.Remainder               first number is divided by the second  Math.Remainder(25,6) = 1
             (Num1, Num2)
                                          number.


            Working With Programs in Small Basic Program
            To create a new Small Basic program:

            1.  Open Small Basic.                             2
            2.  On the Toolbar, click the New button.
                 A blank Editor window opens.                 3

            3.  Type the required code.
                                                          To save a program:

                                                           1.  On the Toolbar, click the Save      button in the File
                                                               group.
                                                           2.  In the Save As dialog box, type the name for the
                                                               program in the File name box.
            2                                              3.  Click the Save button.

                                       3                       Small Basic saves the program with the extension .sb.



              144
   141   142   143   144   145   146   147   148   149   150   151