Program Development Styles and Basics of C 13
In addition, the following symbols (Fig. 1.15) can be used in the flowchart and they are parts of
flowcharts.
Alternate process
Predefined process Internal storage
Manual operation Off-page connector Card Flow lines
Punched tape
Summing junction Or
Collate
Sort
Sequential access
storage
Extract
Merge
Stored data
Display
Direct access
storage
Fig. 1.15 Some other symbols used in the flowchart
1.7 PSEUDOCODE
In pseudocodes english-like words are used to represent the various logical steps. It is a prefix
representation. Here solution of each step is described logically. The pseudocode is just the raw idea
about the problem. By using this tip, one can try to solve the problem. The meaning of pseudocode
is 'false code/ The syntax rule of any programming language cannot be applied to pseudocode.
Example (a): Assume a and b are two numbers and find the larger out of them. In such a case,
comparison is made between them.
14 Programming and Data Structures
This can be represented as follows.
Algorithm
Input a and b.
Is a>b.
Pseudocode
get numbers a & b
Compare a & b
If yes a is larger than b.
If no b is larger than a.
Print the larger number.
larger number is max
if a is large max=a
if b is large max=b
Few skilled programmers prefer to write pseudocode for drawing the flowchart. This is because
using pseudocode is analogous to writing the final code in the programming language. Few
programmers prefer to write the steps in algorithm. Few programmers favour flowchart to represent
the logical flow because with visualization things are clear for writing program statements. For
beginners a flowchart is a straightforward tool for writing a program.
Example (b): The example (b) illustrates how the pseudocode is used to draw a flowchart.
1) Accept number
2) Calculate square of the number
3) Display number
All the steps of the program are written down in steps. Some programs follow pseudocode to draw
flowcharts. Using pseudocode, final program can be written. Majority of programs have common
tasks such as input, processing and output. These are fundamental tasks of any program.
Using pseudocode a flowchart can be drawn as per the following steps.
For the statement, that is, 'Accept number' the flowchart symbol is as per Fig. 1.16.
Fig. 1.16 Input symbol
The* statements including arithmetic operations are examples of processing statements. The
representation of second statement 'Calculate square of the number' can be represented as in
Fig. 1.17.
Calculate square
of the number
Fig. 1.17 Processing symbol
The output statement, that is, 'Display number' can be represented as per Fig. 1.18.
Fig. 1.18 Output symbol
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.215.96