Friday, October 7, 2011

0.3. Pseudocode

Although high-level languages are close to human language, it is usual to explain the steps required to solve a problem using "pseudocode", a language which is more strict than human language, but does not follow the syntax of any real high-level language.

The sequence of steps required to solve a problem is called an "algorithm" (actually, there are a few conditions more, for example, there must be a finite number of steps). Therefore, a computer program is an algorithm expressed using a programming language.

For example, an algorithm to process payments made in a store using credit card, written in pseudocode, might be:


Read card’s magnetic band
Connect with bank central
If connection_available and correct_card:
Request PIN
If PIN is correct
Check balance
If balance >= shopping_amount
Accept Operation
balance = balance - amount
End If
End If
End If


No comments:

Post a Comment