Wednesday, 13 June 2012

PSEUDO CODES AND FLOW CHART


PSEUDOCODES
Pseudo code is text only sentences that describe the logic and program flow of a computer program. Pseudo code esembles plain English.
It usually does not have any specific programming language syntax and grammar.
Pseudo code is directly linked  to the computer codes because each pseudo code statement can often be converted into the programming language virtually line by line.
There are no set rules for writing pseudo code.
A programmer can have his or her personalised pseudo code.
He or she must use consistent language and syntax in the pseudo code, so that he or she can understand it at a later stage.

FLOW CHART

Let’s identify some of the main elements in the flow chart. We have five main elements in a flow chart.

Terminator shows the beginning or end of a program.
Flowline and arrowhead use to connect symbols and indicate the sequences of operation.
Input or output  shows either an input operation (e.g. an INPUT from the
user) or  an output operation (e.g. PRINT some messages).
Process shows a process to be carried out (e.g. calculation).
Decision shows a decision (or choice) to be made. The program should continue along one of two routes (e.g. if...else).

A flow chart is a diagram using symbols to show the step-by-step sequence of procedures in a program. A flow chart describes the logic and program flow of a computer program graphically.

Example:



A student requests his marks from the program.
The program will then check whether his marks is more/equal to 50 or not.
If the marks are over or equal to 50, the program will print a congratulatory message together with the marks.
If the marks are lower than 50 then the program will print a motivational message together with the result.

0 comments:

Post a Comment