Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEE 243B Applied Computer Programming 11 - Flowcharts §Appendix C Sylvain P. Leblanc.

Similar presentations


Presentation on theme: "EEE 243B Applied Computer Programming 11 - Flowcharts §Appendix C Sylvain P. Leblanc."— Presentation transcript:

1 EEE 243B Applied Computer Programming 11 - Flowcharts §Appendix C Sylvain P. Leblanc

2 Review What are the three ways to use the name of a function in a program? Are identifiers required for the parameters in a function prototype? Can you use a void function in an assignment expression? Why/Why not What information does the type of a variable give us? Winter Prof S.P. Leblanc

3 Outline 1.Representing Program Behaviour 2.Flowchart Evolution and Motivation 3.Flowchart Symbols a.Auxiliary b.Primary 4.Flow Control Flowcharts a. if-else b. switch c. for d. while e. do…while 5.Flowcharts and EEE243 3 Winter 2011Prof S.P. Leblanc

4 1.Representing Program Behaviour In the lectures 08 and 09, we have seen flow of control structures: functions, if-else, else- if, switch, while, for and do-while There are several methods to represent the logic behind the use of these constructs Pseudo code – English like statements Flowcharts – Graphical Chapin diagrams – Graphical Winter Prof S.P. Leblanc

5 Flowcharts vs. Structure Charts The Structure Charts that we discussed with functions are also a graphical method, but they are different: Structure Charts describe the hierarchical organization Flow Charts describe the behaviour In Flowcharts, each of the flow control constructs can be graphically represented Regardless if you use OOAD or structured programming, flowcharts can help you visualize the logic flow of a program 5 Winter 2011Prof S.P. Leblanc

6 2.Flowchart Evolution Flowcharts used to be the main design tool for symbolic languages to represent the logic flow of a program Flowcharts fell out of grace when new analysis and design techniques emerged Flowcharts were seen as not scalable for large scale designs Before diagrammatic tools, flowcharts were drawn by hand using stencils 6 Winter 2011Prof S.P. Leblanc

7 2. Flowchart Evolution The production of these charts was tedious, and for large monolithic programs, they were difficult to manage For large programs it used to be common to see “wall flowcharts” So why do we still use them? Our programs are no longer huge monolithic lines of assembler code We decompose our problems into manageable parts (functions) 7 Winter 2011Prof S.P. Leblanc

8 2.Flowcharts Motivation Flowcharts are now used to describe the inside of functions; not the entire program A flowchart shows an algorithm – a way to solve a problem The flowchart frees the programmer from the syntax and details of the programming language and allows him to concentrate on the details of the problem to be solved A pictorial representation of our programs allows us to think more clearly There are several software tools that you can use to draw flowcharts. PowerPoint was used for all these charts Visio also has this capability Winter Prof S.P. Leblanc

9 3a.Flowcharts – Auxiliary Symbols We will not cover all the symbols here, we covered the main symbols that you will need to produce algorithms Terminal symbol – shows start and end of algorithms Flow lines – Shows the order of actions Connector – Shows connecting points in algorithm: When we reach the end of a page or column, When we want to show something that does not fit in the flow Winter Prof S.P. Leblanc Start n

10 3b.Flowcharts – Primary Symbols Assignment Statements I/O Statements Call to a function in another module Compound Statement Winter Prof S.P. Leblanc sum = a + b mult = a * b READ (a) x  abs() from math.h

11 4aFlowcharts – if-else Winter Prof S.P. Leblanc a > 10 Something else TF

12 4aFlowcharts – switch Winter Prof S.P. Leblanc a ? Something m Something 0 Something n mno

13 4.Flowcharts - for Winter Prof S.P. Leblanc Initial condition Condition Update Something T F

14 4.Flowcharts – while Winter Prof S.P. Leblanc Condition Something T F

15 4.Flowcharts – do…while Winter Prof S.P. Leblanc T F Something Condition

16 5.Flowcharts in EEE243 Note that you will be required to create a flowchart to hand in for one of your labs I recommend flowcharting to capture solution you develop when faced with a problem Step 4 in the structured design procedure we covered in lecture 04 Flowcharts are at the same conceptual level a C code But flowcharts make it easier to see the algorithm.. It represents a different abstraction Most student’s generate their flow chart afterwards instead of using it as a design tool That’s a mistake! Practice with flow charting, and complex problems will become easier to solve. Winter Prof S.P. Leblanc

17 Quiz Time Why are flow charts useful? Winter Prof S.P. Leblanc

18 Next Lecture Arrays and Command Line Arguments 18 Winter 2011Prof S.P. Leblanc


Download ppt "EEE 243B Applied Computer Programming 11 - Flowcharts §Appendix C Sylvain P. Leblanc."

Similar presentations


Ads by Google