Title: Visual Basic Flowcharts
1Visual BasicFlowcharts
2- Turn in your vocabulary words
- before you leave!
3Algorithms
- Is a finite sequence of effective statements
that, when applied to the problem, will solve it! - An effective statement is a clear, unambiguous
instruction that can be carried out. - Each algorithm you develop should have a specific
beginning at the completion of one step, have
the next step uniquely determined and have an
ending that is reached in a reasonable amount of
time.
4Example Rise-and-shine algorithm
- Problem
- A student getting out of bed and going to school.
5What is the algorithm?
- Get out of bed.
- Take off pajamas.
- Take a shower.
- Get dressed.
- Eat breakfast.
- Carpool to school/Take a bus.
6Another one Watching Television
- Sit down on the sofa.
- Pick up the remote control.
- Point the remote control at the television.
- Press the Power button on the remote control.
- Wait a few seconds for the television to warm up.
- Do you like the program? If so, go to step 9.
- You do not like the program press the Next
Channel button on the remote control. - Got to step 6.
- Put the remote control on the coffee table.
- Relax.
7Pseudocode
- Step-by-step set of instructions that are very
similar to computer programming instructions. - Written in every day English.
- Helps programmers develop algorithms.
- User friendly.
- They are the steps on how to solve the problem.
- They can be converted in computer code.
8Lets translate our Television-watching steps into
pseudo-code.
- Begin task Watching Television.
- Sit down on the sofa.
- Pick up the remote control.
- Point the remote control at the television.
- Press the Power button on the remote control.
- Wait a few seconds.
- Do you like the program?
- a. Yes. Go to step 9.
- b. No. Go to step 7.
- Press the Next Channel button on the remote
control. - Go to step 5.
- Put the remote control on the coffee table.
- Relax.
- End task Watching Television.
9Flowcharts!
- Is a graphical representation of an algorithm or
of a portion of an algorithm. - Are drawn using certain special-purpose symbols
such as rectangles, diamonds, ovals, and small
circles. - These symbols are connected by arrows called
flowlines. - Are useful for developing and representing
algorithms. - Clearly show how control structures operate.
10 Lets look at the symbols!
E X A M P L E
Action 1
Action 2
Rectangle
- Also called an Action symbol.
- Indicates any type of action. Examples a
calculation or an input/output operation.
Action 3
11Flowline Symbol
The lines connect other symbols, and the
arrowheads are mandatory only for right-to-left
and bottom-to-top flow.
12Oval Symbol
Represents the beginning, the end, or a point of
interruption or delay in a program.
13Connector Symbol
Represents any entry from, or exit to, another
part of the flowchart. Also serves as an
off-page connector.
14Decision Symbol
Represents a decision that determines which of a
number of alternative paths is to be followed.
15Lets turn our Pseudocode for watching television
into a flowchart!
Start
7 Press next channel
4 Press Power
8 Go to 5
1 Sit down on Sofa
5 Wait
9 Put remote down
2 Pick up Remote
10 Relax
N
Y
6 Do you like the program?
3 Point Remote
Stop
Go to Step 9
Go to step 7
16Homework
- Develop a pseudocode and flowchart for the
following. Pick one! Your choice. - On a sheet of paper, draw a square of a specific
size. - Get a drink of water.
- Make a phone call.