1 The simplest control structure is the sequence. The direction of flow passes through all steps in this structure. In pseudocode, a sequence will always be indented the same amount. As a flowchart, the sequence is identified as a number of steps flowing down the flowchart.
2 The three structures are sequence, selection and repetition.
3 A sequence consists of a number of steps that are to be performed one after the other, each step being performed once in the pass.
4 An algorithm in pseudocode starts with BEGIN and finishes with END.
5 Indentation allows the structure of the algorithm to be clearly seen.
6 A flowchart starts and finishes with terminal symbols containing the keywords BEGIN and END respectively.
7 The process symbol represents an action that is to be carried out.
8 The flow direction is from top to bottom since that is the natural direction for us to read.
9
get steak and oil
heat oil in frying pan
put steak into frying pan
turn steak as required
remove steak when cooked
10
get pencil and sharpener
put pencil into sharpener
turn pencil
remove pencil from sharpener
11
a BEGIN sharpen pencil get pencil and sharpener put pencil into sharpener turn pencil remove pencil from sharpener END | b |
12
get bowl, cornflakes, milk and sugar
fill bowl with cornflakes
pour milk over cornflakes as required
pour sugar over cornflakes as required
0 Comments:
Post a Comment
<< Home