【文章內容簡介】
NSI C, Fourth Edition 15 Logical Operators (continued) A First Book of ANSI C, Fourth Edition 16 Logical Operators (continued) char key = 39。m39。 int i = 5, j = 7, k = 12。 double x = 。 A First Book of ANSI C, Fourth Edition 17 The if and ifelse Statements No semicolon here Oneway if statement A First Book of ANSI C, Fourth Edition 18 The if and ifelse Statements (continued) A First Book of ANSI C, Fourth Edition 19 Compound Statements ? Although only a single statement is permitted in an if statement, this statement can be a single pound statement A First Book of ANSI C, Fourth Edition 20 Compound Statements (continued) A First Book of ANSI C, Fourth Edition 21 Compound Statements (continued) ? For example, if (expression) { statement1。 /*as many statements as necessary*/ statement2。 /*can be placed within the braces*/ ? /*each statement must end with 。 */ ? ? statementn。 } ? For very short statements, you can code a plete if statement placed on a single line – if (grade 69) ++passTotal。 A First Book of ANSI C, Fourth Edition 22 The ifelse Statement ? The most monly used ifelse statement is if (expression) statement1。 else statement2。 – 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 Cha