A flowchart is graphical representation that allows developers to visualize the solution to a problem and to present the logic to other team members.
This chapter explain the use of flowchart in representing the solution to a problem. In addition, it explains the use of dry run table to test the correctness of the steps involves in flowchart.
Objectives:
- Problem solving using flowcharts.
- Representing decision and repetitive process in a flowchart.
- Using the dry run table.
Problem Solving Using Flowcharts:
Flowcharts are used to represent the programming logic in a graphical form. It helps depict the logic in a step-by-step process. This helps in better understanding of working of a process.
Drawing Flowcharts:
A flowchart is created by using a set of symbols and the flow of the process is indicated with arrows connecting the symbols. Each symbol represents an activity to be performed to solve the problem.
The following table lists the various symbols and the activity they represent :
In all the activities except the decision and flow lines activities, there is only one inflow and one outflow. The decision activity has one inflow and two outflows. Each of
the two outflows is followed by a decision depending on whether the condition specified in the decision box is true or false.
Now that you know about the various symbols used in a flowchart, let us consider some examples where we use flowcharts to solve problems. Consider the example of withdrawing an amount from an ATM.
Rules For Drawing a Flowchart :
The following flowchart shows the steps to withdraw an amount from an ATM.
American National Standards Institute (ANSI) recommends a number of rules that need to be followed while drawing a flowchart. These rules are:
- The entire logic of a flowchart should be represented using standard symbols.
- The flowchart should be clear, precise, and easy to follow.
- The flowchart should have only one start point and one end point.
- The steps in a flowchart should follow top-to-bottom or left-to-right approach.
- All necessary inputs should be listed in logical order.
- The start and stop symbols should have only a single flow line.
- The input, process, output, and display symbols should have at least two flow lines connecting to the previous symbol and to the next symbol.
- The decision symbol should have one flow line flowing into it and two flow lines flowing out of it for each possible decision.
- Flowcharts should use page connectors if they extend over multiple pages.
- It is useful to test the logic of the flowchart by testing the flowchart using some sample values.
Comments: