【正文】
instructions using a single statement, as in calling a function A First Book of ANSI C, Fourth Edition 4 Relational Expressions ? Simplest decision structure: if (condition) statement executed if condition is true – The condition is evaluated to determine its numerical value, which is interpreted as either true (nonzero) or false (0) – If condition is “true” the statement following the if is executed。amp。amp。amp。amp。amp。 double x = 。 */ ? ? statementn。 – 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。 else if (expression2) statement2。amp。 ? 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。amp。 A First Book of ANSI C, Fourth Edition 28 The ifelse Chain (continued) A First Book of ANSI C, Fourth Edition 29 The ifelse Chain (continued) A First Book of ANSI C, Fourth Edition 30 The ifelse Chain (conti