【正文】
its square root, and that the number is not 0 before calculating 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。 or | in place of the logical amp。amp。 and logical || operators, respectively A First Book of ANSI C, Fourth Edition 38 Common Compiler Errors A First Book of ANSI C, Fourth Edition 39 Summary ? Relational expressions, which are also called simple conditions, are used to pare operands ? Conditions can be constructed from relational expressions using C’s logical operators, amp。amp。, ||, and ! ? A oneway if statement has the general form if (expression) statement。 ? A pound statement consists of any number of individual statements enclosed within braces ? An ifelse selects between two alternative statements based on the value of an expression A First Book of ANSI C, Fourth Edition 40 Summary (continued) ? An ifelse statement can contain other ifelse statements ? The ifelse chain is a multiway selection statement ? The switch statement is a multiway selection statement。 program execution is transferred to the first matching case and continues through the end of the switch statement unless an optional break statement is encountered A First Book of ANSI C, Fourth Edition 41