Вы находитесь на странице: 1из 32

Chapter 3 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.

Flow Charts
A 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.

Flow Charts
Symbols for drawing a flowchart:

Start or End of the program

Input or output operation

Computational Steps or Processing Function of a program

Decision Making and Branching

Connector or joining of two parts of program

Magnetic Tape

Magnetic Disk

HYBRID

For Display

Flow lines

Annotation (foot note)

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.

Guidelines in flowcharting Only one flow line should come out from a process symbol.

OR

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.

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

Start

Stop/End

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

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.

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

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.

Example - Add three numbers


A program is required to read three numbers, add them together and print their total.

Defining diagram
Input Processing Output

Number1 Read three numbers Number2 Add number together Number3 Print total number

Total

Solution

Start
Read Number1 Number2 number3 Add numbers to total

Print total

Stop

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

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

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

Fill in the blanks1. 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.

Assignment

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