Download presentation
Presentation is loading. Please wait.
Published byAudrey Pierce Modified over 9 years ago
1
Computer Science: A Structured Programming Approach Using C1 5-3 Multiway Selection In addition to two-way selection, most programming languages provide another selection concept known as multiway selection. Multiway selection chooses among several alternatives. C has two different ways to implement multiway selection: the switch statement and else-if construct. The switch Statement The else-if Topics discussed in this section:
2
Computer Science: A Structured Programming Approach Using C2 FIGURE 5-19 switch Decision Logic
3
Computer Science: A Structured Programming Approach Using C3 FIGURE 5-20 switch Statement Syntax
4
Computer Science: A Structured Programming Approach Using C4 FIGURE 5-21 switch Flow
5
Computer Science: A Structured Programming Approach Using C5 PROGRAM 5-6Demonstrate the switch Statement
6
Computer Science: A Structured Programming Approach Using C6 FIGURE 5-22 switch Results
7
Computer Science: A Structured Programming Approach Using C7 FIGURE 5-23 A switch with break Statements
8
Computer Science: A Structured Programming Approach Using C8 PROGRAM 5-7Multivalued case Statements
9
Computer Science: A Structured Programming Approach Using C9 Table 5-5Summary of switch Statement Rules
10
Computer Science: A Structured Programming Approach Using C10 PROGRAM 5-8Student Grading
11
Computer Science: A Structured Programming Approach Using C11 PROGRAM 5-8Student Grading
12
Computer Science: A Structured Programming Approach Using C12 PROGRAM 5-8Student Grading
13
Computer Science: A Structured Programming Approach Using C13 FIGURE 5-24 The else-if Logic Design for Program 5-9
14
Computer Science: A Structured Programming Approach Using C14 The else-if is an artificial C construct that is only used when 1. The selection variable is not an integral, and 2. The same variable is being tested in the expressions. Note
15
Computer Science: A Structured Programming Approach Using C15 PROGRAM 5-9Convert Score to Grade
16
Computer Science: A Structured Programming Approach Using C16 PROGRAM 5-9Convert Score to Grade
17
Computer Science: A Structured Programming Approach Using C17 PROGRAM 5-9Convert Score to Grade
18
Computer Science: A Structured Programming Approach Using C18 5-4 More Standard Functions One of the assets of the C language is its rich set of standard functions that make programming much easier. For example, C99 has two parallel but separate header files for manipulating characters: ctype.h and wctype.h. Standard Characters Functions A Classification Program Handling Major Errors Topics discussed in this section:
19
Computer Science: A Structured Programming Approach Using C19 FIGURE 5-25 Classifications of the Character Type
20
Computer Science: A Structured Programming Approach Using C20 Table 5-6Classifying Functions continued
21
Computer Science: A Structured Programming Approach Using C21 Table 5-6Classifying Functions (continued)
22
Computer Science: A Structured Programming Approach Using C22 Table 5-7Conversion Functions
23
Computer Science: A Structured Programming Approach Using C23 PROGRAM 5-10Demonstrate Classification Functions
24
Computer Science: A Structured Programming Approach Using C24 PROGRAM 5-10Demonstrate Classification Functions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.