Difference between revisions of "Structured Programming"
(Created blank page) |
|||
Line 1: | Line 1: | ||
+ | In a high-level, procedural language such as Pascal, Visual Basic, Python or C#, an algorithm can be implemented using just three basic structures: | ||
+ | *Sequence | ||
+ | *Selection | ||
+ | *Iteration | ||
+ | =Sequence= | ||
+ | A sequence consists of one or more statements following one after the other (all programs use sequence, you write them in a specific order). | ||
+ | |||
+ | Here is an example written in pseudocode: | ||
+ | hoursWorked = USERINPUT | ||
+ | hourlyRate = USERINPUT | ||
+ | totalCharge = hoursWorked * hourlyRate | ||
+ | OUTPUT “Total charge: ”, totalCharge |
Revision as of 14:19, 17 December 2018
In a high-level, procedural language such as Pascal, Visual Basic, Python or C#, an algorithm can be implemented using just three basic structures:
- Sequence
- Selection
- Iteration
Sequence
A sequence consists of one or more statements following one after the other (all programs use sequence, you write them in a specific order).
Here is an example written in pseudocode:
hoursWorked = USERINPUT hourlyRate = USERINPUT totalCharge = hoursWorked * hourlyRate OUTPUT “Total charge: ”, totalCharge