7
1 FLOW CHART FLOW CHART FLOW CHART FLOW CHART Introduction The flowchart is a means of visually presenting the flow of data through an information processing systems, the operations performed within the system and the sequence in which they are performed. Program flowchart, describes what operations (and in what sequence) are required to solve a given problem. The program flowchart can be likened to the blueprint of a building. Designer draws a blueprint before starting construction on a building. Similarly, a programmer prefers to draw a flowchart prior to writing a computer program. As in the case of the drawing of a blueprint, the flowchart is drawn according to defined rules and using standard flowchart symbols prescribed by the American National Standard Institute, Inc.

Flowchart

Embed Size (px)

DESCRIPTION

aa

Citation preview

Page 1: Flowchart

1

FLOW CHARTFLOW CHARTFLOW CHARTFLOW CHART

Introduction

The flowchart is a means of visually presenting the

flow of data through an information processing

systems, the operations performed within the system

and the sequence in which they are performed.

Program flowchart, describes what operations (and in

what sequence) are required to solve a given problem.

The program flowchart can be likened to the blueprint

of a building. Designer draws a blueprint before

starting construction on a building. Similarly, a

programmer prefers to draw a flowchart prior to

writing a computer program. As in the case of the

drawing of a blueprint, the flowchart is drawn

according to defined rules and using standard

flowchart symbols prescribed by the American

National Standard Institute, Inc.

Page 2: Flowchart

2

MEANING OF A FLOWCHART MEANING OF A FLOWCHART MEANING OF A FLOWCHART MEANING OF A FLOWCHART

A flowchart is a diagrammatic representation that

illustrates the sequence of operations to be performed

to get the solution of a problem. Flowcharts are

generally drawn in the early stages of formulating

computer solutions. Flowcharts facilitate

communication between programmers and business

people. These flowcharts play a vital role in the

programming of a problem and are quite helpful in

understanding the logic of complicated and lengthy

problems. Once the flowchart is drawn, it becomes

easy to write the program in any high level language.

GUIDELINES FOR DRAWING A FLOWCHART GUIDELINES FOR DRAWING A FLOWCHART GUIDELINES FOR DRAWING A FLOWCHART GUIDELINES FOR DRAWING A FLOWCHART

Flowcharts are usually drawn using some standard

symbols; however, some special symbols can also be

developed when required. Some standard symbols,

which are frequently required for flowcharting many

computer programs are in the next slide

Page 3: Flowchart

3

SymbolsSymbolsSymbolsSymbols

Start or end of the program

Computational steps or processing function of a program

Input or output operation

Decision making and branching

Connector or joining of two parts of program

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 4: Flowchart

4

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

Algorithm and Pseudo CodeAlgorithm and Pseudo CodeAlgorithm and Pseudo CodeAlgorithm and Pseudo Code

Definition of Algorithm (after Al Kho-war-iz-mi a

9th century Persian mathematician) - an ordered

sequence of unambiguous and well-defined

instructions that performs some task and halts in

finite time

Page 5: Flowchart

5

Let's examine the four parts of this definition more closely

1. An ordered sequence means that you can number

the steps (first socks then shoes!)

2. Unambiguous and well-defined instructions means

that each instruction is clear, do-able, and can be

done without difficulty

3. Performs some task

4. Halts in finite time (algorithms terminate!)

Pseudo code is a kind of structured English for

describing algorithms. It allows the designer to

focus on the logic of the algorithm without being

distracted by details of language syntax. At the

same time, the pseudo code needs to be complete. It

describe the entire logic of the algorithm so that

implementation becomes a rote mechanical task of

translating line by line into source code.

Page 6: Flowchart

6

It has been proven that three basic constructs for flow of control are sufficient to implement any "proper" algorithm.

SEQUENCE is a linear progression where one task is performed sequentially after another. WHILE is a loop (repetition) with a simple conditional test at its beginning. IF-THEN-ELSE is a decision (selection) in which a choice is made between two alternative courses of action. Although these constructs are sufficient, it is often useful to include three more constructs:

REPEAT-UNTIL is a loop with a simple conditional test at the bottom. CASE is a multiway branch (decision) based on the value of an expression. CASE is a generalization of IF-THEN-ELSE. FOR is a "counting" loop.

SEQUENCE Sequential control is indicated by writing one action after another, each action on a line by itself, and all actions aligned with the same indent. The actions are performed in the sequence (top to bottom) that they are written.

Example (non-computer)

Brush teeth Wash face Comb hair Smile in mirror

Example

READ height of rectangle READ width of rectangle COMPUTE area as height times width

Page 7: Flowchart

7

IF-THEN-ELSE

Binary choice on a given Boolean condition is

indicated by the use of four keywords: IF, THEN,

ELSE, and ENDIF. The general form is:

IF condition THEN

sequence 1

ELSE

sequence 2

ENDIF