Files

29 lines
825 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
### C++ if 条件分支实战演练 课后习题 - **答案**
#### **一、 填空题**
1. 分岔点 条件语句 数量 关系 逻辑代码
2. `&&`
3. `if-else`
4. `||`
5. 字符 (`char`)
6. `ch - '0'`
7. `(year % 4 == 0 && year % 100 != 0) || year % 400 == 0`
#### **二、 单项选择题**
1. A 2. C 3. C 4. B 5. B 6. C 7. C 8. C(还没讲if-else if -else) 9. B 10. C
#### **三、 判断题**
1. √
2. × (错误的,`<= 80` 前缺少了 `score`)
3. √ (例如计算器案例中,`+ - * /` 就是四种独立的情况)
4. × (正好相反,先用数学公式计算,再用`if`来验证结果是否合理)
5. √
6. √ (这是良好的代码风格)
7. × (因为使用的是多个独立的 `if`,程序会依次检查每一个 `if` 条件)
8. √
9. √
10. √