Algorithm

25 Mar 2012

Introduction to Programming in C++: Algorithms, Flowcharts and Pseudocode

Now i want to share about Sequence... hope can help you to understanding about sequence,,( the first matery on the first meeting of Al-Pro)

A sequence of instructions is called an algorithm. Algorithms are a fundamental part of computing. If you study computing for many years you will study algorithms of frequently used processes. Books have been written on algorithms for such common activities as storing and ordering data. As most problems you get are unique, you will develop your own algorithms. However, you may find standard algorithms for those parts of your programs that do common activities. There are two commonly used tools to help to document program logic (the algorithm). These are flowcharts and Pseudocode. We will use both methods here. Generally, flowcharts work well for small problems but Pseudocode is used for larger problems. Some of the common symbols used in flowcharts are shown below:






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, a flowchart (and equivalent Pseudocode) to compute the interest on a loan is shown below:

 FLOWCHART


PSEUDOCODE
Read NAME, BALANCE, RATE
Compute INTEREST as BALANCE x RATE
Write (Display) NAME and INTEREST

Note : that the Pseudocode also describes the essential steps to be taken, but without the
graphical enhancements. Another example of a flowchart and the equivalent Pseudocode is
shown below. In this case, the program computes the sum, average and product of three
numbers:

FLOWCHART


 PSEUDOCODE
Read X, Y, Z
Compute Sum (S) as X + Y + Z
Compute Average (A) as S / 3
Compute Product (P) as X x Y x Z
Write (Display) the Sum, Average and Product



 you can understand it if you always try and try...

keep try and fight ...!!

nice to share with you guys... see you next..^_^

Tidak ada komentar:

Posting Komentar