This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Structured Programming Sequence: Statements are executed one after another Decision: One or 2 blocks of code is executed to test the condition (If Select) Loops: One or more statements are executed repeated as long as the condition is true (for while) Nested Loops • Statements inside a loop can contain another loop • The inner loop is executed with each iteration of the outer loop 3 types of control structure Sequence Structure – Statements are executed one after another Selection Structure – 1 or two blocks of code are executed to test a condition (if select) Repetition Structure – Executes a code until the condition is proven false (While) Terms Counter – Numeric Variable that keeps track of the number of items that have been processed Accumulator – Numeric variable that totals numbers as they are processed Flag – Variable that keeps track of whether a certain situation has occurred Identify and correct errors 1. Assume that the variable age is declared and has a valid value If age >= 65 then lblAge = “Age is greater than or equal to 65” Else lblAge = “Age is less than 65” End If *lblAge should be age 2. Assume that the variable x is declared and initialized to 1. the is declared and initialized to 1....
View Full Document
- Spring '07
- Control flow, Imperative programming, $ 7