Professional Documents
Culture Documents
Cape Notes Unit1 Module 3 Content 10
Cape Notes Unit1 Module 3 Content 10
Information Technology E
Syllabus Focus: Unit 1 Module 3 Content 10
Specific Objective 10: develop algorithms to represent problem solution;
Content: Simple input, output, processing; control structures: sequence, selection, looping and
iteration.
Here's an algorithm for translating a word into Pig Latin, like from "pig" to
"ig-pay":
1. Append "-".
3. Append "ay"
Here's an improved algorithm for Pig Latin that handles words that starts with
vowels, so that "eggs" becomes "eggs-yay" instead of the unpronounceable
"ggs-eay":
1. Append "-"
a. Append "yay"
4. Otherwise:
b. Append "ay"
a. Append hyphen
i. Append "yay"
c. Otherwise:
i. Append first letter
Overview
In iteration control structures, a statement or block is executed until the program
reaches a certain state, or operations have been applied to every element of a
collection. This is usually expressed with keywords such as while, repeat, for,
or do..until.[1]
Discussion
The basic attribute of an iteration control structure is to be able to repeat some lines of
code. The visual display of iteration creates a circular loop pattern when flowcharted,
thus the word “loop” is associated with iteration control structures. Iteration can be
accomplished with test before loops, test after loops, and counting loops. A question
using Boolean concepts usually controls how often the loop will execute.
Iteration (Repetition) Control Structures
pseudocode: While
count assigned zero
Increment count
End
pseudocode: Do While
count assigned five
Do
Decrement count
Repeat
Decrement count
pseudocode: For
For x starts at 0, x < 5, increment x
End
Additional Sources:
https://webcache.googleusercontent.com/search?q=cache:bcUdjSPgtQsJ:https://
raptor.martincarlisle.com/F-Programming%2520Control
%2520Structures.doc+&cd=1&hl=en&ct=clnk&gl=jm
https://www.unf.edu/~broggio/cop2221/2221pseu.htm