Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

COMPUTER PROGRAMMING 1

Session 1: Introduction to flowcharts

Iván Amaya
CONTENTS
 BASIC FLOWCHART SYMBOLS

 DFC: SYMBOLS

 DFC: FIRST STEPS

 DFD: SYMBOLS

 DFD: FIRST STEPS

 EXAMPLES

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 2


BASIC FLOWCHART SYMBOLS
Begin / End: All flowcharts must begin and end!!!

Read: Allows data input (values given by user)

Print: Allows data output (values delivered to user)

Operation: Perform calculations

Decisions: Change program flow based on values

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 3


DFC SYMBOLS
Begin / End: All flowcharts must begin and end!!!

Read: Allows data input (values given by user)

Print: Allows data output (values delivered to user)

Operation: Perform calculations

Decisions: Change program flow based on values

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 4


DFC FIRST STEPS
Task: Read two numbers and print the sum Option 2

Option 1

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 5


DFD SYMBOLS
Begin / End: All flowcharts must begin and end!!!

Read: Allows data input (values given by user)

Print: Allows data output (values delivered to user)

Operation: Perform calculations

Decisions: Change program flow based on values

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 6


DFD FIRST STEPS
Task: Read two numbers and print the sum Option 2

Option 1

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 7


EXAMPLES
Task: Read id and three grades

Print: Id and average grade

grade = (g1 + g2 + g3) / 3

Id & “/enter” & grade

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 8


EXAMPLES
Task: Read three numbers (a, b, c) and print:

a + b: if c = 0

a * b: if c = 1

What happens when c > 1?

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 9


EXAMPLES
Task: Read three numbers (a, b, c) and print:

a + b: if c = 0

a * b: if c = 1

c!=1 && c!=0

COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 10


EXAMPLES
Read the ID of a person and his/her brute salary. Should the person earn
over 5000 USD, deduct 10% of the salary. Otherwise, deduct only 5%. The
program should print:
Variables:
ID, Brute salary, Discount, Net salary ID, bs, disc, ns

Read three numbers and print the highest one. There must be a message
stating: “Highest number is: ____”.

Read three numbers and print the highest and lowest ones. There must be a
message stating: “Highest number is: ____”, and another stating: “Lowest
number is: ____”.
COMPUTER PROGRAMMING – SESSION 1 IVÁN MAURICIO AMAYA CONTRERAS 11

You might also like