Car Calculation Flowchart - DOC by ekg46839

VIEWS: 22 PAGES: 4

More Info
									                      TIK2O - Computer and Information Science
                                      FLOWCHARTING


                                   PURPOSE OF FLOWCHARTING
                         A flowchart is used to describe or communicate an
                         algorithm (sequence of instructions) to yourself or
                         another.

                                     COMMON SYMBOLS USED


    1. Start or stop the process                                            START




                                                                     TOTAL = TOTAL + X
    2. Process or action box (usually a calculation)                 X=X+1



                                                                           STUDENT
    3. Input from some source (looks like a punched card)


                                                                       “The total is”,total
    4. Output something (looks like a torn piece of paper)



    5. Decision (the if statement)                                                              T
                                                                         X >= 3


                                                                                    F

    6. Predetermined Loop
                                                                              I
                                                                            1..20




Page 1 of 4                                                               d191a53f-3a0e-4ddd-9ab4-
412773ce3b9a.doc
                        TIK2O - Computer and Information Science
                                            FLOWCHARTING


There are many other flowchart symbols. These are used to represent processes, devices,
files, connectors etc. The above six will be all that we will need to describe all of the
algorithms that we will be using this semester.

There is not a direct correspondence between flowcharting and a particular language (C++,
Turing, BASIC, COBOL, APL). Rather a flowchart describes an algorithm – a sequence of
steps that must occur in a particular order in order to solve a particular problem.

                   SAMPLE FLOWCHART – APPROACHING A STOPLIGHT
                                                       The following is intende
                                           d to be humorous and should not be taken seriously


                                START
                                                                                        THE PROBLEM
                                                                                    What should I do when I am taking
                                                                                   “drivers education” and approach my
                                                                                 first traffic light while practice driving?
                      NOTICE THE COLOUR
                        OF THE TRAFFIC
                            LIGHT




                                                    F                                               F
                                                                            Light
                              Light Red?                                   Yellow?


                                       T                                           T


                                                                         Can you see
                     Stop the car and wait a bit.                                                         Drive through intersection
                                                                          any cops?
                                                              T                                 F



                                                                                                         HONK YOUR HORN
                                                                                                         BECAUSE YOU ARE
                                                                             STOP                        HAPPY TO GET
                                                                                                         THROUGH THE LIGHT.




Page 2 of 4                                                                                             d191a53f-3a0e-4ddd-9ab4-
412773ce3b9a.doc
                           TIK2O - Computer and Information Science
                                        FLOWCHARTING


                          start        Examples – 01NAME20.T

                                                      %-----------------------------------
                         clear
                                                      %NAME:01name20.t
                       setscreen
                                                      %DATE:oct 6, 2000
                      randomize                       %PURPOSE: experiment with a for loop
                                                      %PROGRAMMER: Samantha
                                                      %-----------------------------------
                    “enter name”                      cls
                                                      setscreen ("graphics:vga")
                                                      var clr : int
                                                      randomize
                        name                          var name : string
                                                      put "please enter your name?"
                                                      get name
                                                      for i : 1 .. 20
                           i                              randint (clr, 1, 10)
                        1 .. 20                           color (clr)
                                                          put i, name
                                                      end for
                   randint(clr,1,10)     stop
                      colour(clr)                                  start


                       i , name                                  setscreen
                                                                   clear


   %-----------------------------------                        num  0
   %name: 01name20
   %date: October 4, 2000
   %purpose: experiment for a loop                                 name
   %Programmer: Mike Harrison
   %----------------------------------
   setscreen ("graphics:vga")                                     forever
   cls
   var num : int := 0                                          color (num)
   var name : string
   get name
   loop
        color (num)                                              num = 20      T
        exit when num = 20
        num := num + 1                                                 F
        put num, " ", name
   end loop                                                    num  num+1


                                                                num , name               stop


Page 3 of 4                                                                  d191a53f-3a0e-4ddd-9ab4-
412773ce3b9a.doc
                     TIK2O - Computer and Information Science
                                    FLOWCHARTING


    Create your own flowchart for 03AREA.T. Copy the actual TURING original program into the place
                                  provided and then draw the flowchart.
 FLOWCHART                                                   PROGRAM




Page 4 of 4                                                               d191a53f-3a0e-4ddd-9ab4-
412773ce3b9a.doc

								
To top