190 likes | 212 Views
Clearly Visual Basic: Programming with Visual Basic 2008. Chapter 14 Do It, Then Ask Permission. Objectives. Write a posttest loop using the Do…Loop statement Show a posttest loop in both pseudocode and a flowchart Concatenate strings. Testing after the Fact.
E N D
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 14 Do It, Then Ask Permission
Objectives • Write a posttest loop using the Do…Loop statement • Show a posttest loop in both pseudocode and a flowchart • Concatenate strings Clearly Visual Basic: Programming with Visual Basic 2008
Testing after the Fact • Instructions in a pretest loop • May never be processed • Instructions in a posttest loop • Will be processed at least once • Figure 14-1 • Shows the problem specification and algorithms Clearly Visual Basic: Programming with Visual Basic 2008
More on the Do … Loop Statement Pretest syntax The {While | Until}condition section Part of the Do clause Indicates that the condition is evaluated before the loop instructions are processed Posttest syntax The {While | Until}condition section Part of the Loop clause Indicates that the condition is evaluated after the loop instructions are processed Clearly Visual Basic: Programming with Visual Basic 2008
Pseudocode and Flowchart for a Posttest Loop • Figure 14-4 • Shows the pseudocode and flowchart for Example 2 in Figure 14-3 • The repetition diamond • Appears at the bottom of the loop in a posttest loop Clearly Visual Basic: Programming with Visual Basic 2008
The Good Morning Application • Figure 14-5 • Shows the interface for the Good Morning application • Figure 14-6 • Shows each message on a separate line in the control • Figure 14-7 • Shows the pretest and posttest loops in the Good Morning application • Describes the way the computer processes the code in each loop when the user enters the number 0 Clearly Visual Basic: Programming with Visual Basic 2008
But They Said There Were No Strings Attached • Concatenation operator • The ampersand (&) • Used to concatenate (connect or link) strings together • ControlChars.NewLine constant • Represents the Enter key on your keyboard • Used to create a new line Clearly Visual Basic: Programming with Visual Basic 2008
Summary • Instructions in a posttest loop • Will be processed at least once • Do…Loop statement • Used to code a posttest loop • To concatenate strings • Use the concatenation operator: ampersand (&) • Enter key • Represented by the ControlChars.NewLine constant Clearly Visual Basic: Programming with Visual Basic 2008