Computer Programming: Introduction Programming Tools-Flowcharts
Computer Programming: Introduction Programming Tools-Flowcharts
Programming
Lecture 2
Introduction Programming
Tools-Flowcharts
• Flowcharts.
• Pseudo code.
• Hierarchy Chart.
Programming Tools
or
Introduction to flowcharts
e. Only one flow line should enter a decision symbol, but two or three flow lines, one
for each possible answer, should leave the decision symbol.
Example of a flowchart:
Problem 1: Write an algorithm and draw the flowchart for finding the average of two
numbers.
Introduction to flowcharts
Algorithm:
Input: two numbers x and y
Output: the average of x and y
Steps:
1. input x
2. input y
3. sum = x + y
4. average = sum /2
5. output average
Introduction to flowcharts
Introduction to flowcharts
Introduction to flowcharts
Introduction to flowcharts
Introduction to flowcharts
An exercise
Problem 2: Write an algorithm for finding the area of a
rectangle.
Hints:
define the inputs and the outputs
define the steps
draw the flowchart
Intro to RAPTOR
RAPTOR
RAPTOR is a visual programming development environment based
on flowcharts. A flowchart is a collection of connected graphic
symbols, where each symbol represents a specific type of
instruction to be executed. The connections between symbols
determine the order in which instructions are executed. These ideas
will become clearer as you use RAPTOR to solve problems
Start
S tart
procedure Execute a group of instructions defined in
call the named procedure. In some cases some of
PROCESSING
the procedure arguments (i.e., variables) will
be changed by the procedure's instructions.
End
S tart
Variables are computer memory locations that hold a data value. At any given time a
variable can only hold a single value. However, the value of a variable can vary
(change) as a program executes. That's why we call them "variables"! As an example,
study the following table that traces the value of a variable called X.
RAPTOR - Variables
Variables are computer memory locations that hold a data value. At any given time a
variable can only hold a single value. However, the value of a variable can vary
(change) as a program executes. That's why we call them "variables"! As an example,
study the following table that traces the value of a variable called X.
https://www.youtube.com/user/RandallBower
You can also read more about RAPTOR by exploring the same
webpage. It contains some useful articles.
Questions
?
Assignments
Assignments
Draw a flowchart to generate odd numbers from 5 to 99.