Download presentation
Presentation is loading. Please wait.
1
Introduction to C Programming
ET2560 Introduction to C Programming Introduction to C Programming Unit 1, Part 2 Unit 1 Presentations
2
Flowchart Elements Unit 1: Algorithms
3
Begin and End Shapes These shapes are used to begin and end a flowchart The beginning shape has the algorithm name as its label The end shape contains the word “End”
4
Rectangle Shape – Actions
Rectangle has one entry and one exit The text in the rectangle is pseudo-code corresponding to one step in the algorithm
5
Diamond Shape – Decision Point
One entry, two exits (one for “yes”, the other for “no”) Contains one question, with yes/no answer
6
Selection Shape Selection is an extension of the decision point
Instead of a question, the diamond contains a value The value selects which branch to take One “other” branch is used for all other values that don’t have a branch
7
Connector Shape – On-page
Use for a connection on same page Shape shows connection from one point to another Left shape can be used multiple times Right shape, used once, shows the destination of connection
8
Connector Shape – Off-page
Use for a flowchart larger than one page Shape shows connection from one page to another Left shape can be used multiple times Right shape, used once, shows the destination of connection Visio automatically creates a new page when this shape used
9
Shapes Combine to Create Structures
Straight-line structure Single-sided branch Double-sided branch Selection structure Until loop While loop Do-while loop
10
Straight-line Structure
11
Single-sided Branch
12
Double-sided Branch
13
Selection Structure Selection structure is an extension of the branch
All branches must converge together at the end
14
“Do-While” Loop
15
“While” Loop
16
“Until” Loop
17
Flowchart Examples Unit 1: Algorithms
18
Flowchart Example – Count to 9
Here is an algorithm, in pseudo code, to output 1-9: Output “List of Numbers less than 10” Put 1 in number Output number Add 1 to number If number is less than 10, go back to step 3 End
19
Flowchart Created from Algorithm
20
Flowchart Example – Odd #s < 10
Output “List of Odd Numbers less than 10” Put 1 in number If number divided by 2 has remainder 0, go to step 5 Output number Add 1 to number If number is less than 10, go back to step 3 End
21
Flowchart for Odd Numbers < 10
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.