ch04 - Microsoft Visual Basic 2008: Reloaded Third Edition...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Four Making Decisions in a Program
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 2 Objectives After studying this chapter, you should be able to: Include the selection structure in pseudocode and in a flowchart Write an If…Then…Else statement Write code that uses comparison operators and logical operators Create a variable having block scope Concatenate strings
Background image of page 2
Microsoft Visual Basic 2008: Reloaded, Third Edition 3 Objectives (continued) Use the ControlChars.NewLine constant Change the case of a string Generate random numbers
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 4 The Selection Structure Selection structure (or decision structure ): Used to select a path to take based on the outcome of a decision or comparison Condition : The decision to be made Results in a Boolean (True or False) answer Four forms of selection structure: If If/Else If/ElseIf/Else Case
Background image of page 4
Microsoft Visual Basic 2008: Reloaded, Third Edition 5 The Selection Structure (continued) Figure 4-1: Selection structures you might use today
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 6 Writing Pseudocode for the If and If/Else Selection Structures If selection structure : contains one set of instructions to process when the condition is true If/Else selection structure : Contains two sets of instructions One set is processed when the condition is true The other set is processed when the condition is false True path : path to follow when condition is true False path : path to follow when condition is false
Background image of page 6
Microsoft Visual Basic 2008: Reloaded, Third Edition 7 Figure 4-2: Examples of the If and If/Else selection structures written in pseudocode
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 8 Flowcharting the If and If/Else Selection Structures Flowchart uses standardized symbols to show the steps a computer must take Selection/repetition symbol : Diamond shape Represents both selection and repetition structures One flowline entering and two flowlines leaving
Background image of page 8
Microsoft Visual Basic 2008: Reloaded, Third Edition 9 Figure 4-3: Examples of the If and If/Else selection structures in flowchart form
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Microsoft Visual Basic 2008: Reloaded, Third Edition 10 Coding the If and If/Else Selection Structures If…Then…Else statement : used to code the If and If/Else selection structures Else clause : an optional part of the If statement Condition must be a Boolean expression Must evaluate to either True or False Statement block : set of statements terminated by an Else or End If If…Then…Else statement can contain variables, literal constants, named constants, properties, methods, arithmetic operators, comparison operators, and logical operators
Background image of page 10
Microsoft Visual Basic 2008: Reloaded, Third Edition 11 Coding the If and If/Else Selection Structures (continued) Figure 4-4: How to use the If/Then/Else statement to code the If/Then/Else selection structure
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/05/2010 for the course CIS 2656 taught by Professor Marvpelot during the Winter '08 term at Oakland CC.

Page1 / 53

ch04 - Microsoft Visual Basic 2008: Reloaded Third Edition...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online