1. What is repetition control structure?
Repetition control structure is also known as looping or iteration control structure. .Repetition is the act of repeating steps in a certain process. It consists of a branching backwards away from the normal sequence of steps towards an earlier step. The branching decision is based on a relationship between the values of known data (condition) at the time that the branching test is performed. The condition is usually based on the value of a single variable (control variable). The steps to be repeated are referred to as the loop body. Each execution of the steps is referred to as a pass or iteration. The step where the body starts is called as the loop entrance and the step where the test branches back fails is known as the loop exit, it causes the repetition to stop.
It is a process of executing one or more steps of an algorithm or program repeatedly. Repetition is needed to add a list of numbers or variables for each number and one for the total would need to be declared. For a different number of values, recoding would be required. C++ has three repetition structures that repeat statements over and over until certain conditions are met. Repetition control system is very essential in programming for most programs do repetitious tasks.
2. What are the different types of repetition control structure?
The two basic types of loops are pre-test loop and the post-test loop.
PRE-TEST LOOP The pre-test loop can be put to in VB with a "Do" statement followed by either the keyword "While" or "Until". "Do While" means execute the statements entered in the body of the loop While a certain condition is true. "Do Until" means execute the statements in the body of the loop until a certain condition is true. While and Until are opposite to each other, doing something Until a condition is TRUE is the same as doing something While a condition is FALSE. Do While X 10. In C++, while is a reserved word. The...
Please join StudyMode to read the full document