Chap3 flow charts

32
Chapter – 3 Flow Charts

description

 

Transcript of Chap3 flow charts

Page 1: Chap3 flow charts

Chapter – 3Flow Charts

Page 2: Chap3 flow charts

Flow Charts •A diagrammatic representation that illustrates the sequence of operations to be performed to get the solution of a problem.

• Generally drawn in the early stages of formulating computer solutions.

• Facilitate communication between programmers and business people/end users.

• Once the flowchart is drawn, it becomes easy to write the program in any high level language.

• Must for the better documentation of a complex program.

Page 3: Chap3 flow charts

Flow ChartsA flow chart can be used to:

• Define and analyse processes. • Build a step-by-step picture of the process for

analysis, discussion, or communication. • Define, standardise or find areas for

improvement in a process.

Page 4: Chap3 flow charts

Flow Charts

Symbols for drawing a flowchart:

Start or End of the program

Page 5: Chap3 flow charts

Input or output operation

Page 6: Chap3 flow charts

Computational Steps or Processing Function of a program

Page 7: Chap3 flow charts

Decision Making and Branching

Page 8: Chap3 flow charts

Connector or joining of two parts of program

Page 9: Chap3 flow charts

Magnetic Tape

Page 10: Chap3 flow charts

Magnetic Disk

Page 11: Chap3 flow charts

HYBRID

For Display

Page 12: Chap3 flow charts

Flow lines

Page 13: Chap3 flow charts

Annotation (foot note)

Page 14: Chap3 flow charts

Guidelines in flowcharting - • In drawing a proper flowchart, all necessary

requirements should be listed out in logical order. • The flowchart should be clear, neat and easy to follow.

There should not be any room for ambiguity in understanding the flowchart.

• The usual direction of the flow of a procedure or system is from left to right or top to bottom.

Page 15: Chap3 flow charts

…Guidelines in flowcharting - • Only one flow line should come out from a

process symbol.

OR

Page 16: Chap3 flow charts

…Guidelines in flowcharting - • Only one flow line should enter a decision

symbol, but two or three flow lines, one for each possible answer, should leave the decision symbol.

Page 17: Chap3 flow charts

…Guidelines in flowcharting –Only one flow line is used in conjunction with terminal symbol.

Start Stop/End

Page 18: Chap3 flow charts

…Guidelines in flowcharting –Write within standard symbols briefly. As necessary, you can use the annotation symbol to describe data or computational steps more clearly.

This is confidential data

Page 19: Chap3 flow charts

…Guidelines in flowcharting –

• In case of complex flowchart, it is better to use connector symbols to reduce the number of flow lines. Avoid the intersection of flow lines.

• Ensure that the flowchart has a logical start and finish. • It is useful to test the validity of the flowchart by

passing through it with a simple test data.

Page 20: Chap3 flow charts

Advantages Of Using Flowcharts :

• Communication: Flowcharts are better way of communicating the logic of a system to all concerned.

• Effective analysis: With the help of flowchart, problem can be analyzed in more effective way.

• Proper documentation: Program flowcharts serve as a good program documentation, which is needed for various purposes.

• Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and program development phase.

• Proper Debugging: The flowchart helps in debugging process.• Efficient Program Maintenance: The maintenance of operating program

becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that part

Page 21: Chap3 flow charts

Limitations of using Flowcharts :

1. Complex logic: Sometimes, the program logic is quite complicated.

2. Alterations and Modifications: Alterations may require re-drawing completely.

3. Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.

Page 22: Chap3 flow charts

Example - Add three numbers A program is required to read three

numbers, add them together and print their total.

Page 23: Chap3 flow charts

• Defining diagram

Input Processing Output

Number1Number2Number3

Read three numbersAdd number togetherPrint total number

Total

Page 24: Chap3 flow charts

Solution

Add numbers to total

ReadNumber1Number2number3

Print total

Start

Stop

Page 25: Chap3 flow charts

Example 2.

Draw a flowchart to find the sum of first 50 natural numbers.

Page 26: Chap3 flow charts
Page 27: Chap3 flow charts

Example 3Draw a flowchart to find the largest of three numbers A,B and C.

Page 28: Chap3 flow charts
Page 29: Chap3 flow charts

Example 4Draw a flowchart for computing factorial of a given number

Page 30: Chap3 flow charts
Page 31: Chap3 flow charts

AssignmentFill in the blanks- 1. A program flowchart indicates the_________ to be performed and

the __________ in which they occur. 2. A program flowchart is generally read from _____________ to

________________ 3. Flowcharting symbols are connected together by means of

___________________ 4. A decision symbol may be used in determining the ____________

or ___________ of two data items. 5. __________ are used to join remote portions of a flowchart 6. ____________ connectors are used when a flowchart ends on one

page and begins again on other page 7. A ________ symbol is used at the beginning and end of a

flowchart. 8. The flowchart is one of the best ways of ________ a program.. 9. To construct a flowchart, one must adhere to prescribed

symbols provided by the __________ . 10. The program uses a ____________ to aid it in drawing flowchart

symbols.

Page 32: Chap3 flow charts

Answers

• Operations, sequence • Top, down • Flow line • Equality, inequality • connectors • Off -page • Terminal • documenting • ANSI (American National Standards Institute) • Flowcharting template