Initial commit: C++ courseware

This commit is contained in:
xiaolinquan committed 2026-11-05 22:51:02 +08:00
commit 4a4ee7c287
1789 files changed
+373489

No files matched your search

@@ -0,0 +1,28 @@
### **参考答案**
#### **一、 填空题**
1. `&&`, 括号 `()`
2. `(x % 3 == 0) && (x % 2 != 0) && (x % 5 != 0)`
3. `is_blue && price < 50`
4. `(x >= 10 && x <= 20) || (x >= 30 && x <= 40)`
5. `!is_ready`
6. `((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)`
7. `(A && B) || (A && C) || (B && C)`
8. `false`
9. `!(x == 10)`
#### **二、 单项选择题**
1. **B**. "等级和红宝石"是一个整体,"VIP和蓝宝石"是另一个整体,两者是“或者”关系。
2. **B**. 因为 `chinese > 90` (88 > 90) 是 `false`,导致 `(math > 90 && chinese > 90)` 整体为 `false`。
3. **C**. 选项A, B, D描述的都是“可以举办活动”的条件。选项C描述的是“**不能**举办活动”的条件,所以是错误的。
4. **A**. `!(true && false)` -> `!false` -> `true`。 `(false || !true)` -> `(false || false)` -> `false`。最终 `true || false` -> `true`。
5. **C**. "数学或者英语100分"是一个整体条件,需要用括号括起来,再与“作业写完”进行`&&`运算。
7. **D**. 因为 `x > 5` (5 > 5) 是 `false`,导致整个`&&`表达式为`false`。其他选项均为`true`。
8. **B**. “不大于10”就是“小于等于10”的意思。
#### **三、 构建逻辑表达式**
1. `login_ok || token_ok`
2. `!is_special && (is_vip || amount > 200)`