Download presentation
Presentation is loading. Please wait.
Published byFranklin Day Modified over 8 years ago
1
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 14 Do It, Then Ask Permission
2
Clearly Visual Basic: Programming with Visual Basic 2008 Objectives Write a posttest loop using the Do…Loop statement Show a posttest loop in both pseudocode and a flowchart Concatenate strings 2
3
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 3
4
Clearly Visual Basic: Programming with Visual Basic 20084
5
5
6
6
7
7
8
8 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
9
Clearly Visual Basic: Programming with Visual Basic 20089
10
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 200810
11
Clearly Visual Basic: Programming with Visual Basic 2008 11
12
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 200812
13
Clearly Visual Basic: Programming with Visual Basic 200813
14
Clearly Visual Basic: Programming with Visual Basic 200814
15
Clearly Visual Basic: Programming with Visual Basic 200815
16
Clearly Visual Basic: Programming with Visual Basic 200816
17
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 200817
18
Clearly Visual Basic: Programming with Visual Basic 200818
19
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 200819
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.