Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
28 views27 pages

Lecture 1.4 - Introduction To Flowcharts

The document provides an introduction to flowcharts, detailing commonly used symbols such as process activities, flowlines, decisions, and terminals. It includes specific flowcharts for counting cards and summing Maths marks, illustrating the iterative process of picking cards, moving them, and updating counts or sums. Additionally, it presents a generic flowchart structure for iteration, emphasizing the importance of marking elements as visited and updating variables.

Uploaded by

pragya mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views27 pages

Lecture 1.4 - Introduction To Flowcharts

The document provides an introduction to flowcharts, detailing commonly used symbols such as process activities, flowlines, decisions, and terminals. It includes specific flowcharts for counting cards and summing Maths marks, illustrating the iterative process of picking cards, moving them, and updating counts or sums. Additionally, it presents a generic flowchart structure for iteration, emphasizing the importance of marking elements as visited and updating variables.

Uploaded by

pragya mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Introduction to Flowcharts

Flowcharts: Some commonly used symbols

Process or Flowline or Decision Terminal


Activity Arrow
Flowcharts: Some commonly used symbols

Process or Flowline or Decision Terminal


Activity Arrow

Set of operations that


change the value of
data (variables)
Flowcharts: Some commonly used symbols

Process or Flowline or Decision Terminal


Activity Arrow

Shows the order


of execution of
the program steps
Flowcharts: Some commonly used symbols

Process or Flowline or Decision Terminal


Activity Arrow

Determines which
path the program
will take
Flowcharts: Some commonly used symbols

Process or Flowline or Decision Terminal


Activity Arrow

Indicates the
“Start” or “End”
of the program
Flowchart for counting cards
Flowchart for counting cards
Start When we start, the cards are all assumed
to be in a single pile - called Pile 1
Flowchart for counting cards
Start

Count = 0 We initialise the count variable to 0


Flowchart for counting cards
Start

Count = 0

This is where the iterator starts.


We need to repeat the following steps:
• Pick a card from Pile 1
• Move it into a different pile (say Pile 2)
• Increment the value of count

The iteration stops when Pile 1 is empty


Flowchart for counting cards
Start

Count = 0
We need to pick a card from Pile 1
More cards
But we can do that only if there
in Pile 1?
are more cards in Pile 1 to pick !
Flowchart for counting cards
Start

Count = 0

More cards No (False)


in Pile 1?
Yes (True) Two outcomes are possible here:
Either there are no more cards
(condition = False) or there
are more cards (condition = True)
Flowchart for counting cards
Start

Count = 0

More cards No (False)


End
in Pile 1?
Yes (True) If there are no more cards
we can end the program.
The variable count carries the
required value.
Flowchart for counting cards
Start

Count = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Pick a card X from Pile 1 If there are more cards in Pile 1
we pick a card from the pile.
Lets call this card X
Flowchart for counting cards
Start

Count = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Pick a card X from Pile 1 To make sure that we don't
revisit card X again, we move it
Move X to Pile 2 to Pile 2
Flowchart for counting cards
Start

Count = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Pick a card X from Pile 1

Move X to Pile 2
What should we do after we
Increment count increment the value of count ?
Flowchart for counting cards
Start

Count = 0

More cards No (False)


End
in Pile 1?
We go back
Yes (True)
to the
beginning Pick a card X from Pile 1
of the
iteration ! Move X to Pile 2

Increment count
Summary: Flowchart for counting cards
Start
Initialisation: Put all cards in Pile 1
Count = 0 } and set count to 0

More cards No (False)


End
in Pile 1?
Yes (True)

Iteration Pick a card X from Pile 1 Iterative steps:


Move X to Pile 2

Increment count
} • Pick a card
• Move card to Pile 2
• Increment count
Flowchart for Sum of Maths
Marks
Flowchart for counting cards
Start

Count = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Pick a card X from Pile 1

Move X to Pile 2

Increment count
How do we modify this to do Sum of Maths marks?
Start

Count = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Pick a card X from Pile 1

Move X to Pile 2

Increment count
How do we modify this to do Sum of Maths marks?
Start
Initialise Sum to 0
Count = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Pick a card X from Pile 1

Move X to Pile 2

Increment count
How do we modify this to do Sum of Maths marks?
Start

Sum = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Pick a card X from Pile 1

Move X to Pile 2 Add Maths marks


of Card X to Sum
Increment count
How do we modify this to do sum of Maths marks?
Start

Sum = 0

More cards No (False)


End
in Pile 1?
Yes (True)
Rest of the
Pick a card X from Pile 1
flowchart
Move X to Pile 2 remains
Add CardX's Maths score to Sum the same !
Summary: Flowchart for sum of Maths marks
Start
Initialisation: Put all cards in Pile 1
Sum = 0 } and set sum to 0

More cards No (False)


End
in Pile 1?
Yes (True)
Iteration
Pick a card X from Pile 1 Iterative steps:
Move X to Pile 2
} • Pick a card
• Move card to Pile 2
• Accumulate in Sum
Add CardX's Maths score to Sum
Summary: Generic flowchart for iteration
Start

Initialise

Unvisited No (False)
End
elements?
Yes (True)
Pick an unvisited element

Mark element as visited

Update variables

You might also like