Repetitive control structures, also referred to as iterative structures, are groupings of code which are designed to repeat a set of related statements. This repetition (or iteration) can repeat zero or more times, until some control value or condition causes the repetition to cease. We use iterative controls when we need to do the same task more than once, based upon some logical condition. While the terms repetition and iteration are very descriptive words, the common term to describe these control structures is loop. Loops consist of two logical parts; the condition (i.e. the logic that evaluates the condition), and the loop body (i.e. where the code integral to the loop is located). I categorize loops into two general categories:
indeterminate loops
determinate loops
2. Explain the form of iteration structure you would use in solving your problem and why you chose that type.
The difference being that with a determinate loop structure, one can (normally) predict exactly how many times the loop will repeat; whereas with an indeterminate loop structure, this is not always the case. An indeterminate loop structure loops as long as a condition evaluates to some certain boolean value. Indeterminate loops should be used when the programmer does not know exactly how many times the iteration need occur. Logically however, both indeterminant and determinate loops can be written to be equivalent.
The break statement provides an immediate exit from the repetitions structures as well as from the switch structure. The break statement is used to exit from a loop or to skip the rest of the switch structure. After the break statement executes, the program continues to execute with the first statement after the structure. The continue statement is used in while, for, and do…while structures. When the continue statement ...