Download presentation
Presentation is loading. Please wait.
1
Numbering System TODAY AND TOMORROW 11th Edition
Understanding Computers, 11th Edition 1
2
What is a “Flow Chart?” a visual tool that helps you understand the flow of your program You can think of flow charts as pipes of water: You pour water in the top. Water pours through the pipes and is pulled downward Chapter Understanding Computers, 11th Edition
3
Flowchart Based Design
Chapter Understanding Computers, 11th Edition
4
Flow Chart Basics 1 Diamonds (decision symbol)
contain conditions Rectangles represent statements of work. For example: printf() flow line Chapter Understanding Computers, 11th Edition
5
Flow Chart Basics 2 Connector symbol grade >=65 true print “passed”
false Chapter Understanding Computers, 11th Edition
6
if/else Flow Chart True False grade >=65 Print “You failed”
True False grade >=65 Print “You failed” Print “You passed” Chapter Understanding Computers, 11th Edition
7
Flowcharts Represent flow of control of algorithms: sequences
selection iteration Useful for: Finding semantic errors Determining test data set Use of Flowcharts Pseudo-code flowchart Flowchart code Chapter Understanding Computers, 11th Edition
8
Represented by concatenating instructions (usually vertically)
Flowchart: Sequence Represented by concatenating instructions (usually vertically) Instruction in rectangular box Step A: input number Step B: add 1 to number Order of execution indicated by arrows Step C: output number Chapter Understanding Computers, 11th Edition
9
Sequence (cont) Example 2: Step A: input number an algorithm involving
“selection” Step A: input number Step C: output number Example 2: Step A: input number Step B: if number is negative, then add -1 to number else add 1 to number Step C: output number Chapter Understanding Computers, 11th Edition
10
Flowchart: Selection Step A C1 true? S2 Step C S1 YES NO Arrow labeled
with result of condition test Condition test in diamond Step A C1 true? S2 Step C S1 Step A if ( condition C1 ) { <sequence S1> } else <sequence S2> Step C YES NO Chapter Understanding Computers, 11th Edition
11
Example: Algorithm to Flowchart
input number is number negative? add -1 to number YES NO add 1 to number output number input number if number is negative, then add -1 to number else add 1 to number output number Chapter Understanding Computers, 11th Edition
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.