28
3 CHAPTER INSIDE THIS CHAPTER 32 3.1. Problem 3.5. Data Flow Diagram (DFD) 3.2. Design Flow to Solve a Problem 3.6. Text Editor 3.3. Algorithms 3.7. VI Editor 3.4. Flow Chart Overview of Algorithm, Flowcharts and DFD 3. 3. 3. 3. 3.1. PR PR PR PR PROBLEM OBLEM OBLEM OBLEM OBLEM IMPORTANT NOTES Problems are obstacles or undesirable situations that prevent us from getting an objective. So there is thirst to solve the problem in order to get objective. We can classify the problems into categories : n Mathematical n Logical n Political n Social n Economical n Physical n Chemical n Engineering n Medical n Environmental DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNOW At present, we are always try to solve either Mathematical or Logical problems in every context of life.

algorithm,flow chart and data flow diagram

Embed Size (px)

DESCRIPTION

really good .......easily explained

Citation preview

Page 1: algorithm,flow chart and data flow diagram

3CHAPTER

INSIDE THIS CHAPTER

32

3.1. Problem 3.5. Data Flow Diagram (DFD)3.2. Design Flow to Solve a Problem 3.6. Text Editor3.3. Algorithms 3.7. VI Editor3.4. Flow Chart

Overview of Algorithm,Flowcharts and DFD

3.3.3.3.3.11111..... PRPRPRPRPROBLEMOBLEMOBLEMOBLEMOBLEM

IMPORTANT NOTES

Problems are obstacles or undesirable situations that prevent us from gettingan objective. So there is thirst to solve the problem in order to get objective.

��������������� ��������������������������

� ��� �������

� ������

� �������

� �����

� ���������

� � �����

� � �����

� ���������

� ������

� ������������

DO YOU KNODO YOU KNODO YOU KNODO YOU KNODO YOU KNOWWWWW

At present, we are always tryto solve either Mathematicalor Logical problems in everycontext of life.

Page 2: algorithm,flow chart and data flow diagram

33OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

���� ������������������� ���������������������������!����"�������#��� �������$�!

#������$� ���������%

3.2.3.2.3.2.3.2.3.2. DESIGN FLDESIGN FLDESIGN FLDESIGN FLDESIGN FLOOOOOW TW TW TW TW TO SOLO SOLO SOLO SOLO SOLVE A PRVE A PRVE A PRVE A PRVE A PROBLEMOBLEMOBLEMOBLEMOBLEM

& ����������� ������"�� �"���'��

�����"���%

What are the things that you require to dothe design?

Step-by-step solution of problem in EnglishLanguage or in Engish- Program-Style.

Flow Chart is a modeling tool to describe our algorithm pictorially or graphically,this is easy to understand

DFD is a modeling tool, which contains some functional/process through whichdata flow from one location to another location

Whatever you write in algorithm, we have to just design it using any programlanguage like C, C++, Java, and Dotnet etc.

(��� � �� � �������������� ������ ���� ����� ��������� ��� "���������� ��� ��������� ��

����������� ���%�)� ���� �������������� ��������������������������� ����������� �����

������(����� ����*�� �� �����!�+������ �+������� � ��������������������������� �

����������������!��������%

3.3.3.3.3.3.3.3.3.3. ALALALALALGORITHMSGORITHMSGORITHMSGORITHMSGORITHMS

(������� �������������������������������'�����(����� �������� � ���%

IMPORTANT NOTES

An Algorithm is the step-by-step procedure to solve a particular problem ineither in pure english language or in english programming style.

(���(����� ��������� ������������������������� ����

����� ����������� ���������������������%

�����������

&�� ������ � �� ���"��� ��� � �� ���������(�!�,�"���� ��

������ ��������� �����"����������-"��� ����� ������ ��

�����

Assign the inputs, which is obtainedfrom user, to A & B

DESIGN IDEA

SPECIFIC ATIO N

ALG ORITHM S

FLOW CHART

DATA FLO W DIAG RAM

IMPLEMENTATIO N USING A NY LANG UAGE

DO YOU KNODO YOU KNODO YOU KNODO YOU KNODO YOU KNOWWWWW

Implementation of a problemusing any programming lan-guage is just weighted 20%of the complete project & theremaining 80% weightageuses the documentation parti.e. Algorithms, Flow-Charts,Data Flow Diagram.

DO YOU KNODO YOU KNODO YOU KNODO YOU KNODO YOU KNOWWWWW

Algorithm is used to calculatethe time & space, a programtakes for its execution andstorage respectively (i.e.running time).

Page 3: algorithm,flow chart and data flow diagram

34 INTRODUCTION TO PROGRAMMING

&��������� �����"������� �����������(�!�,�"������������� ��������� �����������

������-"��� ����� ������ ��������

set A <- {Enter first input} or set A := {Enter first input}

set B <- {Enter second input} or set B := {Enter second input}

3.3.3.3.3.3.3.3.3.3.11111..... CharCharCharCharCharactactactactacteriseriseriseriseristics of Algorithmstics of Algorithmstics of Algorithmstics of Algorithmstics of Algorithms

.% ��� � /���������������"���������������"���������(����� �%

0% ����� � /���������������"�������"�������(����� �%

1% ������������ � ��� �����"������"����������������"�����"�"�������� ��������

�������������������%

2% ���������� � *�������������������� ���"����������������� �����"������

������������ �"��������������%

3% ������������� � ������ ����"������"��� ��� ������ ��������� ������� ��� ��� ��

����"����������������4�����������������������5%

3.3.2.3.3.2.3.3.2.3.3.2.3.3.2. FFFFFororororormat of an Algorithmmat of an Algorithmmat of an Algorithmmat of an Algorithmmat of an Algorithm

FORMAFORMAFORMAFORMAFORMAT OF ALT OF ALT OF ALT OF ALT OF ALGORITHMGORITHMGORITHMGORITHMGORITHM

���������������4��"����"��"�5

���� ������������������� ����"�

������ ������������������� ���"��"�

.%

0%���������(����� �6����� � ��������������"����������������

%������������������������������������������������� ��� �"��������������%

%

�%

SAMPLE ALSAMPLE ALSAMPLE ALSAMPLE ALSAMPLE ALGORITHMGORITHMGORITHMGORITHMGORITHM

Sum (A,B, Out)

A: first input

B: second input

Out: Sum of A + B (output)

1. Get the two inputs from the user

2. Assign the inputs to A & B

3. Set out : = A + B or Set out <- A + B

4. Exit

���� ���������������(����� ���"����� ���������� �������� �� � �� ����"���������

(�!�,����������"��"���"�%�& �������������� ��-"��������� ��� ����"�������� ��"�������

��������� ����"������� ��� ����"���(�!�,������������� �����"������ ���"��"���"�%

3.3.3.3.3.3.3.3.3.3.3.3.3.3.3. An ExAn ExAn ExAn ExAn Examamamamamplepleplepleple

�����������������������������������������

Page 4: algorithm,flow chart and data flow diagram

35OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

ALALALALALGORITHM IN ENGLISH LANGUGORITHM IN ENGLISH LANGUGORITHM IN ENGLISH LANGUGORITHM IN ENGLISH LANGUGORITHM IN ENGLISH LANGUAAAAAGE SGE SGE SGE SGE STTTTTYLE FYLE FYLE FYLE FYLE FOR THE ABOR THE ABOR THE ABOR THE ABOR THE ABOOOOOVE PRVE PRVE PRVE PRVE PROBLEMOBLEMOBLEMOBLEMOBLEM

������ �!

���(�������������"�������� ��'����"������� ��� ��� ���� �����"����������.7�������

.% ����(��8"������.

0% 9������������1�!�2� ���4(�:�..5

1% ������ �����"����(

2% ����������� �����"����(����.

3% ���

ALALALALALGORITHM IN ENGLISH PRGORITHM IN ENGLISH PRGORITHM IN ENGLISH PRGORITHM IN ENGLISH PRGORITHM IN ENGLISH PROGRAMMING SOGRAMMING SOGRAMMING SOGRAMMING SOGRAMMING STTTTTYLE FYLE FYLE FYLE FYLE FOR THE ABOR THE ABOR THE ABOR THE ABOR THE ABOOOOOVE PRVE PRVE PRVE PRVE PROBLEMOBLEMOBLEMOBLEMOBLEM

1. Set A ←←←←← 1

2. Do (step 3 & 4) while (A < 11)

3. Print A

4. A ←←←←← A + 1

5. Exit

IMPLEMENTIMPLEMENTIMPLEMENTIMPLEMENTIMPLEMENTAAAAATION OR C PRTION OR C PRTION OR C PRTION OR C PRTION OR C PROGRAM FOGRAM FOGRAM FOGRAM FOGRAM FOR THE ABOR THE ABOR THE ABOR THE ABOR THE ABOOOOOVE PRVE PRVE PRVE PRVE PROBLEMOBLEMOBLEMOBLEMOBLEM

# include <stdio.h>

main ()

{

int A;

A = 1;

while (A < 11)

{

printf (“%d”,A);

A ++;

}

}

3.3.4.3.3.4.3.3.4.3.3.4.3.3.4. Algorithm AnalyAlgorithm AnalyAlgorithm AnalyAlgorithm AnalyAlgorithm Analysississississis

(�������� �� �������;�� �� �������� � ��� ������� %�%� � ��"� �����"����������

��������������"����������������� ��"�������������������������"�����������������������%

IMPORTANT NOTES

Complexity is defined as the total space and time required to store and toexecute an algorithm or problem.

& ������������������������ ������$��%�%

.% ���������������

0% &������������

Page 5: algorithm,flow chart and data flow diagram

36 INTRODUCTION TO PROGRAMMING

Space ComSpace ComSpace ComSpace ComSpace Complepleplepleplexitxitxitxitxityyyyy

IMPORTANT NOTES

Space complexity of an algorithm is the total space used or required to storean algorithm or program in memory.

"�����������#��������������$���#����

�! "������������%����������� & ���������������������� ������������ � ������

�������������������������������������������%

�! "�����������#����������� & ���������������������� ������������ � ����������

�������������������������� ������������ ���;����� �����"�������������!� � ��

��������������"������������������������������������%

TTTTTime Comime Comime Comime Comime Complepleplepleplexitxitxitxitxityyyyy

IMPORTANT NOTES

Time Complexity of an algorithm is total time required to execute an algorithm.

&�����������#��������������$���#����

�! '����������� & ��������������8"�������� ��'��"��������������������� �������

�����������������������%�%�� ������������!���������%�%��������������%

�! (��������� & ��������������8"�����������"������������%

3.3.5.3.3.5.3.3.5.3.3.5.3.3.5. TTTTTechniqechniqechniqechniqechniques used tues used tues used tues used tues used to Design an Algorithmo Design an Algorithmo Design an Algorithmo Design an Algorithmo Design an Algorithm

11111..... RRRRRecurecurecurecurecursivsivsivsivsive Algorithme Algorithme Algorithme Algorithme Algorithm

9��"�������� �8"����"������ ������������������������������ ����������������"�����

��������� � ������ ��

A (I)

(1) set I = I + 1

(2) if I > 10, exit; Call itself i.e. recursion

(3) else Print “I”;

(4) Go to A (I);

2.2.2.2.2. Divide and ConqDivide and ConqDivide and ConqDivide and ConqDivide and Conquerueruerueruer

+�����������8"������ �8"����� ������� ������������������%���� ����� ���������

�������������;%

4�5 +������������������������ ������"���"�6��������

4��5 �������� ����������������"�������"����� ������������������%

4���5 & ��������������� ���"�6�������������������������������������� �����"��%

3.3.3.3.3. ItItItItIterererererativativativativative Mee Mee Mee Mee Methodthodthodthodthod

��������� ��� �8"�� ��"���� ��� ������ �� ��������"���� ��������� %�%� ������� � �� ����

��������"���������������"��������������� ������������ ������������������ �������� �

���������������������� �%

Page 6: algorithm,flow chart and data flow diagram

37OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

4.4.4.4.4. Dynamic PrDynamic PrDynamic PrDynamic PrDynamic Progrogrogrogrogrammingammingammingammingamming

& ��(����� ����������"����+������������������������ �"����������������������

���"�������������������"��� � ���������"�����"���� ���������"��� ������������ �������

���"���%

5.5.5.5.5. GrGrGrGrGreedy Algorithmseedy Algorithmseedy Algorithmseedy Algorithmseedy Algorithms& ��(����� ����������"����<������������� �������������������������� �����"����

�"�������������� ������������"�����������������������%

6.6.6.6.6. BrBrBrBrBrututututute Fe Fe Fe Fe Forororororce Algorithmce Algorithmce Algorithmce Algorithmce Algorithm& ��,�"��� *����� ������� � ������� ��� ����� ������������ ���� �������� � ��"� � �����

���������"���������������"���%

77777..... BrBrBrBrBranch and Boundanch and Boundanch and Boundanch and Boundanch and Bound& ��(����� ����������"����,���� �!�,�"���������� ��������������'�����"��"����

�"�6������������ � ������������������ ���� ������ ������ ��� � �� �����"���� �� ���� ��

�����������"������� � ����� �������� %

8.8.8.8.8. Backtracking AlgorithmBacktracking AlgorithmBacktracking AlgorithmBacktracking AlgorithmBacktracking Algorithm,��'����'���(����� ���������������"������� �����"�������"���� ����������������

������������������"�����������������������������"�"����"���������"�������"��%

3.3.6.3.3.6.3.3.6.3.3.6.3.3.6. Some ExSome ExSome ExSome ExSome Examamamamamples tples tples tples tples to Wo Wo Wo Wo Writritritritrite Algorithmse Algorithmse Algorithmse Algorithmse Algorithms

Example 1. )�����������������������%�$���������∆∆∆∆∆��������������%��������*

Triangle (A, B, C)A: first side of the triangleB: second side of the triangleC: third side of the triangle

1. Set A ←←←←← {Enter first side}2. Set B ←←←←← {Enter second side}3. Set C ←←←←← {Enter third side}

4. If A = B C2 2+

5. Go to (11)

6. If B = A C2 2+

7. Go to (11)

8. If C = A B2 2+

9. Go to (11)10. Print “not forms a right angled triangle” & Exit11. Print “forms a right angled triangle” & Exit

Example 2. )������������������������+��������������,�������������%%�*

Evenodd (A)

A: A is the number to be checked weather it is even or odd

Page 7: algorithm,flow chart and data flow diagram

38 INTRODUCTION TO PROGRAMMING

1. Set A <- {Enter a number}

2. if ( A % 2 = 0) then

Print “A is Even number” & Exit.

3. Print “ A is Odd number” & Exit.

Example 3. )�����������������������%���������������-��������*

Smallest (A,B,C)

A: first number

B: second number

C: third number

1. Set A ←←←←← {Enter first number}

2. Set B ←←←←← {Enter second number}

3. Set C ←←←←← {Enter third number}

4. If (A < B & A < C) then

5. Print “A is smallest” & Exit.

6. If (B < C & B < A) then

7. Print “B is smallest” & Exit.

8. If (C < A & C < B) then

9. Print “C is smallest” & Exit.

Example 4. )���������������������$���$��������������������%���������*

Swap (A,B)

A: first number

B: second number

1. Set A ←←←←← {Enter first number}

2. Set B ←←←←← {Enter second number}

3. Set C ←←←←← A

6. Set A ←←←←← B

7. Set B ←←←←← C

8. Exit.

Example 5. )����� ��� ��������� ��� �$�� �$�� ��������$������� ������ ����%

�������*

Swap (A,B)

A: first number

B: second number

Page 8: algorithm,flow chart and data flow diagram

39OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

1. Set A ←←←←← {Enter first number}2. Set B ←←←←← {Enter second number}3. Set A ←←←←← A + B6. Set B ←←←←← A - B7. Set A ←←←←← A - B8. Exit.

3.4.3.4.3.4.3.4.3.4. FLFLFLFLFLOOOOOW CHARW CHARW CHARW CHARW CHARTTTTT

*�� �� ������� ��������������������������� ��(����� �%

IMPORTANT NOTES

This is a modeling tool to describe an algorithm pictorially or graphically,which is easy to understand.

3.4.3.4.3.4.3.4.3.4.11111..... AdvAdvAdvAdvAdvantantantantantages of Floages of Floages of Floages of Floages of Flow Charw Charw Charw Charw Chartststststs

� ,���� ���� ���� �� ���"���� � ��� ���� ������ ��

"���������%

� �������������� ���!��������������������"����"���%

� & ����������������������� �����"��������%

� ���������"�����������������������%

� ��������������������������������"��������������������������%

� ���������� ���������������������%

� +������ �"������6�"������ �������� ��%

3.4.2.3.4.2.3.4.2.3.4.2.3.4.2. Symbols Used in FloSymbols Used in FloSymbols Used in FloSymbols Used in FloSymbols Used in Flow Charw Charw Charw Charw Charttttt

"#��������% .��� /��%������$�������

�� =>(� ?���������������������

�� �(9(����=<9(� ?���������"�������"��"�%

��� 9��&()<�� ?����������������

��� +������,�� ?�������������

��)� ?�������� � ����� ����������

���������� �=))��&=9 ?�������-���� ��������������

DO YOU KNODO YOU KNODO YOU KNODO YOU KNODO YOU KNOWWWWW

Flow-Char t is used togenerate the sequence orflow of events in which problemis solved and represent theflow of events graphically.

Page 9: algorithm,flow chart and data flow diagram

40 INTRODUCTION TO PROGRAMMING

3.4.3.3.4.3.3.4.3.3.4.3.3.4.3. ExExExExExamamamamamples of Floples of Floples of Floples of Floples of Flow Charw Charw Charw Charw Chartststststs

Example 1. ���$�����$���������������$���������,

Solution.

STAR T

Input Two NumbersA AND B

C: = A + B

PRINT C

STOP

Fig. 3.1.

Example 2. ���$�������$�������������%�$���������∆∆∆∆∆��������������%�������*

Solution. STAR T

If A B C2 2= +

Print "fo rm s a rightangled tria ngle"

N O

If B A C2 2= +

If C A B2 2= +

N O

N O

ST O P

YE S

YE S

YE S

Fig. 3.2.

Page 10: algorithm,flow chart and data flow diagram

41OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

Example 3. ���$�������$�������������%������������������-��������,

Solution. START

INPUT 3 num bera, b, c

If a > b

If b > c

Print c is sm allestPrint b is sm allest

STOP

If a > c

print a is sm allest

Yes

N o

Yes

N o

YesN o

Fig. 3.3.

Example 4. ���$�������$�������������%������������-���������*

Solution. START

INPUT a, b, c

AVERAGE = (a + b + c)/3

PRINT AVERAGE

STOP

Fig. 3.4.

Page 11: algorithm,flow chart and data flow diagram

42 INTRODUCTION TO PROGRAMMING

Example 5. STAR T

SU M = 0

N = 0

N = N + 1

SU M = S U M + N

Is N = 5 0 ?

Yes

PR IN T SUM

EN D

Fig. 3.4.

Example 6. � Software Development

Start

D es ign

C oding

Testing

End

D esignError?

Yes

Yes

N oN o

Errors?

Fig. 3.5.

Example 7. ��������������������Sta rt

En d

InputN

M = 1F = 1

OutputF

DoesM = N?

F = F *M

M = M +1N o

F = 1*2*3 ... *N

Yes

Fig. 3.6.

Page 12: algorithm,flow chart and data flow diagram

43OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

3.5.3.5.3.5.3.5.3.5. DADADADADATTTTTA FLA FLA FLA FLA FLOOOOOW DIAW DIAW DIAW DIAW DIAGRAM (DFD)GRAM (DFD)GRAM (DFD)GRAM (DFD)GRAM (DFD)

IMPORTANT NOTES

It is modeling tool that allow us to make system as a network of functionalprocesses, connected one another by “Pipelines” & “Holding Tanks” of data.

SynonSynonSynonSynonSynonymymymymyms fs fs fs fs for DFDsor DFDsor DFDsor DFDsor DFDs

.% ,"������ ���

0% �������������

1% ,"�����+�����

2% ���'�*�� �+�����

3% *"�����������

��� �� ���� �� � ������� ���������"���� ��������������� ����� ��� ����������� ������� �

� �� ��"���������� �����������������������������������!��������������� ���� �

������ ��������������"�����%

���������"��������� �������������%

3.5.3.5.3.5.3.5.3.5.11111..... SSSSSttttteps in Dateps in Dateps in Dateps in Dateps in Data Floa Floa Floa Floa Flow Analyw Analyw Analyw Analyw Analysississississis

� ��"�������������!���������������%

� ������� � �������������������� ������������������%

� �������� ����"��������� ��"���������������%

� ����������������������%

� ����������������%

� ������������������%

�������������� �����������������������������!����������������%

3.5.2.3.5.2.3.5.2.3.5.2.3.5.2. DatDatDatDatData Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagramsamsamsamsams

+���� �� � �������� ���� ��� "���� ��� ������� �� ������ �������������� �� ���� �"�����

"�����%� & �� ��� �8"�� ������� � � ��� �������� ���"��� �� � �� �"������ ���� �����"��� ��

�����;������ ���� ��"�����������������������%�& �������������������������"�������������

� ������������������8"���%�& ����� �8"��������������� �������������6�� �������������

����"���� ����������������������� ��%

DatDatDatDatData Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram Nam Nam Nam Nam Noooootttttationsationsationsationsations

& ������������������������� �������"������� ����� ������"���������������������

4����� �� ��������5%�& ���� ������ � ���������� ����� ��� � � � �� �"���� � ��� ������ ��

� ��%

DO YOU KNODO YOU KNODO YOU KNODO YOU KNODO YOU KNOWWWWWData Flow Diagram is used tocheck the flow of data i.e. howdata is stored in database orhow data is retrieved from thedatabase or how it is updated.

Page 13: algorithm,flow chart and data flow diagram

44 INTRODUCTION TO PROGRAMMING

Custom er

Accountin fo rm ation

C ash Accountin fo rm ation

D2 Account DetailsEnquiriesDeposits andWithdrawals

2 Counter

Fig. 3.7.

& �������������������������'������������ � ����������"�����������"���%��� � �

����������"������������ � ��� �������������� ����8"����������������"��� �������"��

���"������� �������"���������%�& ��������������������"������� �������������������

� ��"�������������������8"���������� ������"��������������������%

ExtExtExtExtExtererererernal Entitnal Entitnal Entitnal Entitnal Entityyyyy

(�����������������������"���������������������������� � � ��

�"������ �����������"��%�=����� ����������� � ������������������

���������������������������"��������������������%�& ���������"���

���������������������������"������"�8"��������%

PrPrPrPrProcessocessocessocessocess

(� �������� � � �� �� ������������� �������"������ �� ����� �� �

� ��� ��������%�& ���������"���������������"�������� � ��������

1���������������������

*������ ��� ���������� �"����� �������� �� � �� "����� ���� ���

������%�& ���������������������������� ����������������������������"�8"�

��������%

���������� �� �������� �������� ��� � �� �� �� �� � �� ������� ���

��������� ���� �� � �� ������� � �� �������� ��'��� �����%� & ������� ��� ��������� ��� �

����������������������� ��� ���%�*������������������������������������ ������������ �

���%�& ��� �"�������������������������������� � ��������������������������#������

�"��������������$����#��������$%

DatDatDatDatData Floa Floa Floa Floa Flowwwww

(� ����� �� � � � �� � �� �� � �� ��������� ���� ��� ��"���� ��� ��

���������%�(�������� ������������������������� � ����� ������ � ��

� �������������� %������������� ������ �������������������������

������� ��������������������������%���� �������� ��������������������

� ��������������������������������� �����������������������������������

��������%

DatDatDatDatData Sa Sa Sa Sa Stttttorororororeeeee

(� ����� ������ �� �� ������ ������ ��� ��������� � �� � �

�������

��������������������������������������� ����������%

+���� ����������� ��� ����6����� ���� �"� � ��� ������ ��������� ������� ��� � ���6����

���"�"�������� ��������������� ��������"������ � ������� ����� ���������������%����

������������ �"�������������������������� �������������������"����%

Custom er

EnquiriesDeposits andWithdrawals

2 Counter

Accountin fo rm ation

D2 Account Details

Page 14: algorithm,flow chart and data flow diagram

45OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

RRRRResouresouresouresouresource Floce Floce Floce Floce Flowwwww

(�����"������ �� � ��� ���� �������� �����������������������"���

��� ��� ���������%� *��� � �� ������� � ��� ���� ��������� �������� ��� ��

� �������� �%

& ��� ����������������8"������� �"�������������������"������%�9���"������ �

����"�"������������������������� � 6����������������������"���� ������������������ �

� �������� ������������������������������������������ ����� ���������%

DatDatDatDatData Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram–Ram–Ram–Ram–Ram–Relationship Gridelationship Gridelationship Gridelationship Gridelationship Grid

External Entity

Process

Data Store

External Entity Process Data Store

Fig. 3.8.

& ���������"�����������������"������������� ������������������������ � �� ������

������������������ ��%

DatDatDatDatData Floa Floa Floa Floa Flowwwwwsssss

*���������� ��� ���"��������������� ���

+���� �� �� ���� ����"���� �� �� ���� ���� ��� ��� ���� ��������� ������� ���� ���������%

+������ ��������������� ������ ��������������������������%�@� ������������� �����

����"������ �������������� ������ �����������������������������������%

PrPrPrPrProcessesocessesocessesocessesocesses

*�������������� ��������� ��"��������������� ��

+������ ����������"������ ���������� ������ ���������������������������������

���� ��� ���� ���������� ���� ����� ������%� & ��� ���� ����� ���� ��� ��� ���� ������

���������%������ ��� �����������������������"������ � ������� ������������ ���"�����

�������� ������%

DatDatDatDatData Sa Sa Sa Sa Stttttorororororeseseseses

*���������������� ��������� ��"��������������� ��

+������ ����������"������ ���������� ������ �����������������������������%�@� �����

� ������ �������������� ������ ������������������������������������������ ������������

�������������� ��%������������� ��������� ����������������������������������"������

������������� �����8"�������������������� �%

C ash

Page 15: algorithm,flow chart and data flow diagram

46 INTRODUCTION TO PROGRAMMING

DatDatDatDatData Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram – Contam – Contam – Contam – Contam – Conteeeeext Diaxt Diaxt Diaxt Diaxt Diagrgrgrgrgramamamamam

BookSupplier

Book Details

Book

Order

BorrowerBook

Return Request

Availabilityand Advice

0 Context

Library

ReservationEnquiry

Borrower

Num ber

Fig. 3.9.

& ���������������������������� � �������� �������"����� ����������%�& ��������

� �"��������� �����������"������������������������ ����������� ������������%

& �� ����������� �� �� �������� ����������� �������� � � �� ��� � �� ������%� & �� ������

"����� ����������� �� ������������ ��� �� ������ ��������� ���������� ��� ��������� ������� ��

������� ����������"������ �%

& �������������������������� � ��� �������������� ����� ���������"���������������

���� � �� ��������� ������� � � � � �� ����"������%� & �������� ���� �� �� ����

�������"����� ������������������������������� ��� ��"�������������� � �����������"�����

�������� ��������������� ������������������ ���������%

& ������������������ � ������ �������������������������'��������������%�& ��������

��������������������'�����������������'���������������������'��"������%

,��'��������� ������������������ ���������������� � ���"����� ������ ��8"���� ��

����������� ����"����%�& ��������� ������������� ���� �����������������'��������

������������ ���������� ������'��������������"�%

��������������"����������'��������'��"������ ���"��� �������������������'���

���������������������8"���%

)����� � ��� ����"�������� �������� ��������� ������� ���� ����� ���"���� ���� � ��

������� � �� #������$� �������%�� ���� �� ���'� �"������ �"��� ����"������ � � ����"�

����������������������"��� ���������� ����"�������6�� ����������� ����������������� �

#������$����������������� �����������"�������� ����������������%

Guidelines tGuidelines tGuidelines tGuidelines tGuidelines to Dro Dro Dro Dro Draaaaaw Contw Contw Contw Contw Conteeeeext Diagrxt Diagrxt Diagrxt Diagrxt Diagramamamamam

*���������� ������������������������������� ��������������� ��������������%

)�������������������� ������������������� �������"�������������� � �� ���������

���%�+��� ������������������������������������� ������"������ ������������� �%

*������������ ������"������ ������������� ������ ��������%

Page 16: algorithm,flow chart and data flow diagram

47OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

������ ���� �������������������"�� �"��������������������� � �� ���������������

��������� �� �%�& ���� ��� ��� ���������� � � ��"��� �"� ����� � �������� ���� �������

���� � ��'���� � � �������� ����� �"������� ������� ���� � � � �� ������ �� ������%

9��������� �������"������������������������ ������������"����6�� ��������������"��

�� ����� ����%

LeLeLeLeLevvvvvel 1 Diagrel 1 Diagrel 1 Diagrel 1 Diagrel 1 Diagramamamamam

External Entity

External Entity

Process

Process

Process

D ata Store

D ata Store

D ata Store

Fig. 3.10.

& ��������.��������� � ��� ������"����������������� ���������"���������������%

(�� � � � �� �������� �������� ���� �������"����� ����������� � �"��� ��� ������������ ��

���������������.�������%

& ������������"���� �������������������������� ���������� ������������������.

�������%�������.����������� � �"���������������� � ������ "���������������� � �� �������

������"�� �"��������� �����������������"������ ����������������������� ��������%�(�

�����������"�������"���������������������� �"���������������� ���.0��������������%

& ��������.�����������"���"��������� ���"���������������������� ��������������� �

��"������� �� � �� ������%�,���"��� � �� ������ .� �������������� � �� ���� �� � �� ������

"����������������������������"������'�� � ������������%

DatDatDatDatData Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram—Tam—Tam—Tam—Tam—Top-Doop-Doop-Doop-Doop-Down Expansionwn Expansionwn Expansionwn Expansionwn Expansion

& �� ������� �������� � �� �������� �� ���� �� �� ���������� ��� �������%�*"�� �������� �

��"�������� � ��� ���� � ������������������������������������ ������.�����������������

��������� �������������������������"����"���� ����������������%

��� ��������� � ���� ������"���������������������������� � �� �"�-���� �� "�� ��

�������%�& �� �������� �������� � �� �� ��� ������ ���������� � ��� ����� ��� ������"��� � �

������������� ������������������%�& ��������"�����'�� ��������6�� �������������

�������%

(�����"�������������������������������������� �������������������������"��������

� ���������� ����������������%

������������ ��"�������� ���������������6�� ��������������������� ��� �������������

� � �� � �� � �� �"������ �������� ������%�)�������� �� � � ��� ����� � �� �"����� �� � �

��������������� � � �����������������"����� ����� �������������.�������%

Page 17: algorithm,flow chart and data flow diagram

48 INTRODUCTION TO PROGRAMMING

Level X

Level X+1

Fig. 3.11.

(������������������.�����������'���������8"���"�� ���������������� ��������.�������

��������������������"�������������� ���� ���"������������%

& �������� ���� � � �� ������ .� ������� � ���� ��� ��� �� ������ �� �� ��� ������ �������%

& ����������������������������0�� ������1����������%������������� ������0���"�"������"����

��������"�"�"�������������"��������������������������1%

���� ����������� �����������"�������1�����������.�� �����������������"�� ���� �����

��������������������0�������%

���� ��������0���������"���������������������� ��������������������� ���"������

�� � ���� �����������"��� ������� � �� ������� �������%� & ������� � �� ������ 0� ���������� ���

�"�������1%.��1%0��1%1�����1%2

�"������� ������ �����"��������0���������������� ������"��������������������������

���-"����"�� ����������%�& ��������������$������1%1����"���� ������"�� ��������;������"����

�� �� ������������� ������ 1� ������%�=���� ����� � �� �"������� �� � ���� �����������"��

�������� ����������������%�& �������� ����� ����������1����������������"�������1%1%.��1%1%0

����1%1%1%

DatDatDatDatData Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram—Nam—Nam—Nam—Nam—Numbering Rumbering Rumbering Rumbering Rumbering Ruleuleuleuleule

& �������������������� �� ������.��������� �"�������"������������������ ��� � �����

��������������%������ ��������������������������� ������������������ �����������

� ���������������������������� ��� � �� �������� ��� ��� �� ������� � ����������������

����%

& ������� � ����������������� ������.����������"��������6�"������� � �"��������

� ������������ ��������%�& ������"�� � �������"���������������������6����� ���

���������������������������8"����������������%

@� ���������� ���������������"����������������.��������������� ������������"������

���������������� ��%�& ���������������������0����������"����������� �����������������

� ��� ��������.�������%�& ������������� �"��������"��� ��"� �������1�������������

��������� �"���� �����������������������������8"���%

Page 18: algorithm,flow chart and data flow diagram

49OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

3

Process

3.2

Process

3.3

Process

3.1

Process

3.3.4

Process

3.3.1

Process

3.3.3

Process

3.3.2

Process

Fig. 3.12.

& ������������� ����������������� ��"�������� � �������������� �� ��� �������������

������� ���������������� %

3.5.3.3.5.3.3.5.3.3.5.3.3.5.3. AdvAdvAdvAdvAdvantantantantantages of DFDages of DFDages of DFDages of DFDages of DFD

� ������"�������������"�����!��"�������������

� ����������������������������� �������������

� ��� �����������������"����������� ��"�����������"����������������

3.5.4.3.5.4.3.5.4.3.5.4.3.5.4. DeDeDeDeDevvvvveloping a DFDeloping a DFDeloping a DFDeloping a DFDeloping a DFD

TTTTTop-Doop-Doop-Doop-Doop-Down Apprwn Apprwn Apprwn Apprwn Approachoachoachoachoach

.% & �������������������'��� A�� �������� ������+*+B�� � �� � �� � �� A���������B

4����� �� �5� ��� ���� A� �� ������B� 4������������ ��� ���� �������5� ���� A� �� ������

����������B� 4�������������������������5%

0% & �����������A��������������� ���������+*+�4/���5B�������������A���������������

������������� ��������� ����� ����� �����������������������������B%

1% ��� ������������ ���������������������A������� ���������������������������

�"����������B%

2% & ��������� �A� ��������"������� ���"���8"�����"����������B��"���������������

�����"����� �������������� ������ ��� � � ���������� ����������������� 4�'�

� � ��������������5%

3.5.5.3.5.5.3.5.5.3.5.5.3.5.5. DFD LeDFD LeDFD LeDFD LeDFD Levvvvvelselselselsels

ContContContContConteeeeext Lext Lext Lext Lext Levvvvvelelelelel

& ��������� � ��� ��������������������� ��������������$�������������������������

� � ��� �� ��������������-"��������������%�������������"�"������ � ��������������"�����

Page 19: algorithm,flow chart and data flow diagram

50 INTRODUCTION TO PROGRAMMING

� ��� ���� A� ���B� ��� ��������� ��������� �%�%� ���� ��������� ��� �"�� ������������� ��� � �

�������� � ������� �������������� � ��������������������%

LeLeLeLeLevvvvvel 0el 0el 0el 0el 0

& �� ������ � � �� ���� ���������� ��� � �� ���� ������ �� �"�������� ����� �������� ��������

������������ ��������� ����� ����� ��%�& ���"��������� �� ������ ������ � �� ����-��

� �������������������� �������������� ��������������%�(��������������� ��� ��������

��������������������7�������%�(�������7���������"��������������� � ��$����������������

��������������%�%�� �����"������� ���������������������������� �������������� ���� ���

����������'����� ������������������� ��������7���%�%�� ��A.��8"��B�������� ���"����������

����A��8"�����8"���B�����A��8"������"���B�����������������%

3.5.6.3.5.6.3.5.6.3.5.6.3.5.6. ExExExExExamamamamample of DFDple of DFDple of DFDple of DFDple of DFD

11111..... AutAutAutAutAutomatomatomatomatomated Coured Coured Coured Coured Course Rse Rse Rse Rse Regisegisegisegisegistrtrtrtrtrationationationationation

EX T ER N A LEN TIT Y AP P L IC AT IO N

AC C EP T/D EC LIN EEN R O L LM E N T

C H E C K A PP LIC A N TQ U ALIFIC AT IO N

2

C H E C K C O U R S EAVAILA BIL IT Y

1EN Q U IR Y

C O U R SE S

AP P L IC AT IO N S

R E PLY

R E PLYEN Q U IR Y

Fig. 3.13.

& ��+*+� ������������"������� ��"���� ����������� � � �� ��*�%�1%.1����� �� � ��'�

�"����������� ��� ���� ����"������� � ����������������������������������� � �������

���4.5������ ��'���� ����������� ��������� ���������������������������������������� ��

�������� ��'�� ��� ���� �����������"����� ����8"�������8"������������� � �������

���405���������"������ ���� ������������������������� �� �����-�����%

2.2.2.2.2. Online OrOnline OrOnline OrOnline OrOnline Order Syder Syder Syder Syder Syssssstttttememememem

& ��+*+�������������������������������� � ����*�%�1%.2������������������ ���"������

������� ��� �� ���������������� � �����4.5���� ���������"��%������������������������

+.%��� ����������� ���� �������������������������������"���$�����������������$����-�����

Page 20: algorithm,flow chart and data flow diagram

51OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

� 405�%�%�������� ��'%���� ���������������������� ������������������������������+�������

+0������������� ������ ������������������ ��������!�������� ���"�������� ���������

�������� ������"��� � �����"��������!����������"��%

C U S TO M ER

3 SH IPP IN G

SH IP O R D E R

2 C Y BER C H EC K

VE R IF Y C R ED ITC A R D

1 E-C O M M ER C E

PR OC E SS OR D ERAC KN O W L ED G EM EN T

O R D ER

C O N FIR M ATIO NAN D D ELIVE RY

D ATE

C R E D IT C AR DC O M PA N Y

D2 IN V EN TO R Y

C U S TO M ERD ATAB AS E

D1

C R E D IT C AR D N U M BE RAN D OT H E R AM OU N T

AP PR O VA L O RR E JE C TION

O R D ER IN FO R M AT ION

PR OD U C T T Y PE AN D A M O U N T

C U S TO M ER AN D O R D E R IN F OR M AT IO N

Fig. 3.14.

3. Ex3. Ex3. Ex3. Ex3. Examamamamamplepleplepleple

Ap plies toU nive rs ity

Ap prova l

R eg is tra tio nStud ent

In fo rm ation

Acceptance Le tte r

D en ia l Letter

Prog re ss R epo rt

Ap plica tio n

Stud ent In form ation

Stud ent

Stud entD ataba se

Fig. 3.15.

Page 21: algorithm,flow chart and data flow diagram

52 INTRODUCTION TO PROGRAMMING

4. A Le4. A Le4. A Le4. A Le4. A Levvvvvel Datel Datel Datel Datel Data Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram fam fam fam fam for the Same Syor the Same Syor the Same Syor the Same Syor the Same Syssssstttttememememem

Custom er

Custom er Custom er

Enqu iry ProcessEnqu iry

1

ProcessEnqu iry

2

C us tom ersStoreD 2 Item

StoreD 2

ItemIn fo rmation

Item deta ils /ava ilab ility

Custom erDeta ils

O rd erStore

D 3

O rder

O rder D etails

Item s

Invoice

Fig. 3.16.

3.6.3.6.3.6.3.6.3.6. TEXT EDITTEXT EDITTEXT EDITTEXT EDITTEXT EDITOROROROROR

IMPORTANT NOTES

Text editor is a program that enables you to create and edit text files.

& �������������������������������������"��� ���������������� ��������������������

11111..... Line EditLine EditLine EditLine EditLine Editorororororsssss(��������������������� �����8"������"�������������������������������������"

������'��� ����������%

2.2.2.2.2. ScrScrScrScrScreen-Orienteen-Orienteen-Orienteen-Orienteen-Oriented Edited Edited Edited Edited Editorororororsssss������������������������������� ������� ��������������������"������������������� ��

������������ �������������������������� ���"��������� ����������������%

3.6.3.6.3.6.3.6.3.6.11111..... TTTTTypes of Types of Types of Types of Types of Teeeeext Editxt Editxt Editxt Editxt Editorororororsssss

(1)(1)(1)(1)(1) NNNNNoooootttttepad++ (used only in Wepad++ (used only in Wepad++ (used only in Wepad++ (used only in Wepad++ (used only in Windoindoindoindoindowwwwws opers opers opers opers operating syating syating syating syating syssssstttttem)em)em)em)em)

.����%00� ��� ������������� � ���"��������������� ��=������������������

� ����������������������������"����������������)������%���� ��������������� ����������

���"������'��������� � �� ���������������������������%

)������CC�����������������������������"������������"�����"����;����%

Page 22: algorithm,flow chart and data flow diagram

53OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

& ���������� �����.����%00���� � ������

Fig. 3.17.

(2)(2)(2)(2)(2) Emacs (used in all platfEmacs (used in all platfEmacs (used in all platfEmacs (used in all platfEmacs (used in all platforororororms i.e. use anms i.e. use anms i.e. use anms i.e. use anms i.e. use any opery opery opery opery operatingatingatingatingatingsysysysysysssss tttttem)em)em)em)em)

������ �%�����1�'��"!������"��������� ����"��6�

������� ���� �� ��"�� '�������� ��������%� & �������� �

���"���������������������%

&���"��������������������������$�����$

Fig. 3.18.

DO YOU KNODO YOU KNODO YOU KNODO YOU KNODO YOU KNOWWWWW

Platform independent meansthat the editor is independenton the operating system thatthe system uses i.e. the editorcan be run either on windowsor Mac OS or Unix or Linux.

Page 23: algorithm,flow chart and data flow diagram

54 INTRODUCTION TO PROGRAMMING

(3)(3)(3)(3)(3) UltrUltrUltrUltrUltraEdit (used only in WaEdit (used only in WaEdit (used only in WaEdit (used only in WaEdit (used only in Windoindoindoindoindowwwwws opers opers opers opers operating syating syating syating syating syssssstttttem)em)em)em)em)

/����%�������"���6����������������������������� � � ����� �����"�������"����

������� � �� ���������������������������������������������"������������%�?�������

��"���������� ��� ��� ������������� � � �6�"��� ��������� ���"���� �'��@&�����@��

D���������������"� �����%

&���"��������������?��������������$�����$

Fig. 3.19.

(4)(4)(4)(4)(4) TTTTTeeeeextMatxtMatxtMatxtMatxtMate (used only in Mac OSX opere (used only in Mac OSX opere (used only in Mac OSX opere (used only in Mac OSX opere (used only in Mac OSX operating syating syating syating syating syssssstttttem)em)em)em)em)

&���1���������� ��"�����������������������������"�� ���-"������ ����������'����

8"�'��� ������ �� ����� ���"������ � � �$�� ���������� ��������� �� ��"���������� ���

�� ���������%

& ���������� �����&���1������� � ������ ��

Fig. 3.20.

Page 24: algorithm,flow chart and data flow diagram

55OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

(5)(5)(5)(5)(5) Vim (used in all platfVim (used in all platfVim (used in all platfVim (used in all platfVim (used in all platforororororms)ms)ms)ms)ms)

2������������������������������������������� ��>�����������%��'���������>���

�����������������������%�(���������� ������������������ ���������>������>����������

������� ���������>������ �����%

& ���������� �����2������ � ������

Fig. 3.21.

(6)(6)(6)(6)(6) TTTTTeeeeextPxtPxtPxtPxtPad (used only in windoad (used only in windoad (used only in windoad (used only in windoad (used only in windowwwwws opers opers opers opers operating syating syating syating syating syssssstttttem)em)em)em)em)

�'�������������������������&�����%�������� �����������������"������������������

�'��������� � �� ��������������'���������������������� � �����������������"��%

& ���������� �����&�����%���� � ������

Fig. 3.22.

Page 25: algorithm,flow chart and data flow diagram

56 INTRODUCTION TO PROGRAMMING

3.73.73.73.73.7..... VI EDITVI EDITVI EDITVI EDITVI EDITOROROROROR

>�������� ��������������� � ���"��������������!����

����� ����!������"����� ��� A>��� ���� �����B� ���� � � �

����������������?)�E�������%

& �� >�� ������ ��� � �� �� ��"�� ���"���� ��� ��

�����������%

3.73.73.73.73.7.....11111..... Vi TVi TVi TVi TVi Teeeeext Editxt Editxt Editxt Editxt Editor Operor Operor Operor Operor Operating Modesating Modesating Modesating Modesating Modes

>�������������������������������������� ������������%�����������%���%�%

IMPORTANT NOTES

When the editor is in insert mode then whatever typed becomes the part ofthe document and put these typed keystrokes into the current file.

IMPORTANT NOTES

When the editor is in command mode then the keystrokes entered by keyboardare interpreted as commands that control the edit session.

&�����3�4� ������������������� �� ���� ����������������������%

&�����#�4���������� �����������������#$�� ����������� �����"����%

3.73.73.73.73.7.2..2..2..2..2. HoHoHoHoHow tw tw tw tw to So So So So Stttttararararart the VI Tt the VI Tt the VI Tt the VI Tt the VI Teeeeext Editxt Editxt Editxt Editxt Editororororor

& ��>������������������"���������������� ����������������������%�& ������������

������� ��>������������������ ������� ��������%�*��������������������������������������

��"� �"������������������#%�F�"�����������>�� � �"�������������"�� �����"� ������

�������"�� ��'����"� ��� ������������>�� � ���������������������������%

� �����"�������>������ �������������"� ��������������������� � �������4(���������'�

�'��� ���G5����� ������������� ������������� � ������ �

��

��

��

��

��

��

��

��

����������������� �����������

(�������'�������������� ��������� ���������� � ��� �� ��%�(��� �������������"�

��������� ���������� �"������� � ������"��������������������������� ���;����� �

��� ������� � ����� ������'��� ��

“filename” 21 lines, 385 characters

DO YOU KNODO YOU KNODO YOU KNODO YOU KNODO YOU KNOWWWWW

VIM is the earlier version ofVI text editor.

Page 26: algorithm,flow chart and data flow diagram

57OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

��� �������"������������������������ ����� ����������"�� ����������� ������'��� ��

“newfile” [New file]����"���������>�� � �"������������� ���������������� ��������� ���-"����������'%

3.73.73.73.73.7.3..3..3..3..3. HoHoHoHoHow tw tw tw tw to Exit fro Exit fro Exit fro Exit fro Exit from VI Tom VI Tom VI Tom VI Tom VI Teeeeext Editxt Editxt Editxt Editxt Editororororor

)� �� �����"�'�� � � ������������>����� �� �����������������"� � ������������� ��>

����������%�& ��>�������� ���� ����������������������������"����>�����"� ���������� �

����� �����%

@��� ��'�����������A�����B����A���B����������������� �����%�����"� �����������

��� ��������������� �����"������ ��A�����B�'�������$�� ����������� ���������"�

��"� �������������� ������� �����%

3.73.73.73.73.7.4..4..4..4..4. TTTTTeeeeext Bufxt Bufxt Bufxt Bufxt Buffffffererererers used in VI Ts used in VI Ts used in VI Ts used in VI Ts used in VI Teeeeext Editxt Editxt Editxt Editxt Editororororor

& ��>�� ������ ��� 1H� �"���� ��� ������� ������ �� ������ �"�� �� � � ���� �"��� �� �

���������"�������"��%�(�������������'����������������������� �����������������������

� ���������� �"�������"��%�& ������'� �� ����� �� ����� ������� ������ ����"��� �� ��� � ��

���������"�������"������ ����� � �� ������������"���%�& ���"��� ���������"����� �

A�������B%� *��� ��������� � �� ��������� 5�%%6� "���� � �� �"������ ���� � �� ����� � �

� ��������������������������"���������%

3.73.73.73.73.7.5..5..5..5..5. Some SimSome SimSome SimSome SimSome Simple VI Tple VI Tple VI Tple VI Tple VI Teeeeext Editxt Editxt Editxt Editxt Editor Commandsor Commandsor Commandsor Commandsor Commands

*���� ���������������������������������"������>��&���������%

�����'�����% ����������

�$7�������� ������4�����5�� ���"���������"����%���� ������������������� ������������ �

���������������� �����������%

�8 I"���� �������� � �"��������� ���"��������%

���7�������� ������� ����������������� �������%

�� ������� ��������������� �������%�?��"�� ����� ������'�������� ���������

���� � ��"��������������%

��7�������� 9�����4������5�� ������������� ����������������� ���"���������"����%

�$8 I"���� ������������������ ���"��������%

�� ������ ������������ � �� � ��������� ������ �� ��� ��� �������� ����� � �� �"�����

�"�����������%�����"�����������"��������� �������� ��� ���������������� ��

������������� ������������%

�� ������ ���"��������� ����������� ��������������%

�� ������ ������������ � ��� ��������������� �� ������ ��������������� ���"�����

�"�����������%�����"�����������"��������� �������� ��� ���������������� ��

������������� ������������%

�9 ������ ���"������� ���������%

�+ ������ ���"�����"���������%

� ������ ���"��������� ���� ������� ��������������%

�� ������������� ��������"������ ���"����%��������������������������"�������� ��������

�� "����� �������� ��������� ����%�&�����"������ �����6���� ��� ����%

�� �������� ��������"������ ���"����%�������������� � ������� ������������������%

& ��� ��������� �������������������� ���"����%

Page 27: algorithm,flow chart and data flow diagram

58 INTRODUCTION TO PROGRAMMING

3.73.73.73.73.7.6..6..6..6..6. ComComComComCompilation and Rpilation and Rpilation and Rpilation and Rpilation and Running a Vi tunning a Vi tunning a Vi tunning a Vi tunning a Vi teeeeext editxt editxt editxt editxt editor pror pror pror pror progrogrogrogrogramamamamam

&��'���������� � ���������������,�

CC filename.c

OR

GCC filename.c&��(�������� � ���������������,�

a.Out

OR

/a.out�,�������:�,���� ����"������� � ����"������������������������"����>�����������%

SUMMARSUMMARSUMMARSUMMARSUMMARYYYYY

�, ��������������������������"������������"������� �����������"������������������-�����%

���� ������� �������������� ���������������������������-�����%

;, (��(����� �� �� � �� ����6��6����� ������"��� ��� ������ �� �����"���� �������� �� �"�� � �

����"���%

-, '������#� ������������ ������������������������8"������������������������"�����

������ ������������%

<, ��������������������������� ����� ��������������"���������8"���������������������� �

�������������������%

=, &����'������#������������ ����������������8"�����������"������������ �%

>, & �������������������������������"�������� ������������������� ������� � �������

���"���������

?, +*+����������������� ������� �"�������'����������������� ��'���"������������������

������������������ ������A�������B�!�A@������&��'�B�������%

@, +������ ��� �8"��� "���� ��� ������ ��� ������ ��� ���� ���"������ �����!� ���8"���

���'����'��������� �!���"�������������+�������������������������������� ����"��

�������� ��%

A, >���"���������"������� ���� �� ���������������������������������������������������

����������� ���%

��, & ��A�������������B��������������������'�������������"��� �������������������"�����

�"��"�%

��, & ��A+����*�� ������B��������� ���� ����������� ���������������������������!���������

������%

�;, & ��A+���������������B�������������������������� ����"����������������%

�-, & ��A��������������B������������������������ � ���������� � �� ����������"�"����

��������"��������� � ��� ������������;����%

�<, &�����%������������������ �������������"���������������������������

�=, ������������(��������������������� �����8"������"����������������������������

��������"�������'��� ����������%

�>, "�������������%��%������������������������������"������������������� �������������

� �������������������������� ���"��������� ����������������%

�?, >�������� ��������������� � ���"��������������!��������������!������"��������A>��

���������B����� � �������������������?)�E�������%

Page 28: algorithm,flow chart and data flow diagram

59OVERVIEW OF ALGORITHM, FLOW CHARTS AND DFD

��

������

�@, � ���� ���������������������%��� ��� ���������������������� ���������� �����"����

�����"��� ����������'������'�������� ���"��������%

�A, � ��� � �� ������ �� �� ������%���%�� � ��� � �� '������'��� �������� ��� '�������� ���

������������������������ ������������ ������������%

EXEREXEREXEREXEREXERCISESCISESCISESCISESCISES

�, � �������� ��� ����������������������� �J

;, �������������� ������ ���� ���"������ � �"��"����� ����������%

-, � ������ ������������� �������� � ����!�+������ �+������J

2% +�� ����� � ����� ���������� ���"������#�$�!�#�$������������ ����������� ��%�����������

����������������������� �� ���"��������������

=, � �����>�������J

>, �������������� ��������������*������������������������� �� ���� � ���%

?, ����������������������������>���������������� �����������J

@, � �������������� ������������8"����������������� ����������%�<���������������

������������������������������������������ �����������J

A, +�� ����� � ���������� �� ���� ��������"������������������%

��, � ��������"��������������� ��J�<�������������%

��, � ������ ������������� �������� � ��������������� ��������J

�;, +�� ��� � �������� ������ ����

45 ����������������#)$��"�����

45 ������� ���"��������������"����%

�-, +�� ��� �� �������� ������ ����

45 ������� ������������"�����������������#)$��"�����

45 ��������� ������������"��������������������%

�<, ,��������"���� �����"������>�������%

�=, �������+*+� � �����������%

�>, � ������ ������������� �������������������������������J

�?, & �������������������4�.��.5�� 4�0��05�����4�1��15%�=��������� � �������� ��'��� ������

��������%

�@, ������ ������������������������J

���