【正文】
g the number’s reciprocal value. A First Book of ANSI C, Fourth Edition 36 Case Study: Data Validation (continued) A First Book of ANSI C, Fourth Edition 37 Common Programming Errors ? Using the assignment operator, =, in place of the relational operator, == ? Letting the ifelse statement appear to select an incorrect choice ? Nesting if statements without including braces to clearly indicate the desired structure ? Using a single amp。 else if (expression2) statement2。 else statement3。 – If the value of expression is 0 statement2, the statement after the reserved word else, is executed A First Book of ANSI C, Fourth Edition 23 The ifelse Statement (continued) A First Book of ANSI C, Fourth Edition 24 The ifelse Statement (continued) A First Book of ANSI C, Fourth Edition 25 The ifelse Statement (continued) A First Book of ANSI C, Fourth Edition 26 The ifelse Chain ? Nested if statement: if (expression1) statement1。 A First Book of ANSI C, Fourth Edition 22 The ifelse Statement ? The most monly used ifelse statement is if (expression) statement1。 */ ? ? statementn。 /*as many statements as necessary*/ statement2。 double x = 。m39。amp。amp。amp。amp。amp。amp。amp。 double a = , b = , plete = 。amp。amp。A First Book of ANSI C Fourth Edition Chapter 4 Selection A First Book of ANSI C, Fourth Edition 2 Objectives ? Relational Expressions ? The if and ifelse Statements ? The ifelse Chain ? The switch Statement ? Case Study: Data Validation ? Common Programming and Compiler Errors A First Book of ANSI C, Fourth Edition 3 Introduct