Wednesday, October 13, 2010

Flow chart and Pseudocode

Flowchart:

A flowchart is a type of diagram, that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting these with arrows. This diagrammatic representation can give a step-by-step solution to a given problem. Data is represented in these boxes, and arrows connecting them represent flow / direction of flow of data. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields

Name the four flowchart structures :

1. Sequence
2. Selection
3. Repetition
4. Case

Symbols of flowchart

A typical flowchart from older computer science textbooks may have the following kinds of symbols:

Start and end symbols
    Represented as circles, ovals or rounded rectangles, usually containing the word "Start" or "End", or another phrase signaling the start or end of a process, such as "submit enquiry" or "receive product".

Arrows
    Showing what's called "flow of control" in computer science. An arrow coming from one symbol and ending at another symbol represents that control passes to the symbol the arrow points to.

Processing steps
    Represented as rectangles. Examples: "Add 1 to X"; "replace identified part"; "save changes" or similar.

Input/Output
    Represented as a parallelogram. Examples: Get X from the user; display X.

Conditional or decision
    Represented as a diamond (rhombus). These typically contain a Yes/No question or True/False test. This symbol is unique in that it has two arrows coming out of it, usually from the bottom point and right point, one corresponding to Yes or True, and one corresponding to No or False.  


With flowcharting, essential steps of an algorithm are shown using the shapes above. The flow of data between steps is indicated by arrows, or flowlines. For example sequence type of flowchart :



Pseudocode :


The purpose of using pseudocode is that it is easier for humans to understand than conventional programming language code, and that it is a compact and environment-independent description of the key principles of an algorithm. No standard for pseudocode syntax exists, as a program in pseudocode is not an executable program. Pseudocode resembles, but should not be confused with, skeleton programs including dummy code, which can be compiled without errors. Common key always used are following : START, READ, SET, COMPUTE/CALCULATE, DISPLAY, END.

Flowcharts can be thought of as a graphical alternative to pseudocode

Example : Repetition flowchart

 

Example : Selection flowchart
 

Example : Pesudocode


Repetition
Selection
 




6 comments:

Unknown said...

This is very useful information for studying the basic of C++ . Thanks for this...

Evan said...

Thanks for very informative information. What other symbols can be used to implement c++ programs? Is there a symbols to symbolize a data storage?

Regards,
Creately

Nyolei said...

This is great. Am headed for exams and this has been helpful

Nuraisha Sofea said...

Thank you for this!

TECHINMATHS said...
This comment has been removed by the author.
Unknown said...

Very informative ....Thankyou

Post a Comment

 
Copyright © C++ Lab