commit 0207414c505d99c094750a565e67ae6d736d4ceb
Author: Isaac <3388214266@qq.com>
Date: Fri Feb 13 23:38:38 2026 +0800
init
diff --git a/imgs/QQ_1758351896772.png b/imgs/QQ_1758351896772.png
new file mode 100644
index 0000000..5d0a3ed
Binary files /dev/null and b/imgs/QQ_1758351896772.png differ
diff --git a/imgs/image-20250601215956519.png b/imgs/image-20250601215956519.png
new file mode 100644
index 0000000..7b941a4
Binary files /dev/null and b/imgs/image-20250601215956519.png differ
diff --git a/imgs/image-20250601220104712.png b/imgs/image-20250601220104712.png
new file mode 100644
index 0000000..a3d5ce8
Binary files /dev/null and b/imgs/image-20250601220104712.png differ
diff --git a/imgs/image-20250601220355280.png b/imgs/image-20250601220355280.png
new file mode 100644
index 0000000..433a810
Binary files /dev/null and b/imgs/image-20250601220355280.png differ
diff --git a/imgs/image-20250601220658402.png b/imgs/image-20250601220658402.png
new file mode 100644
index 0000000..0b66047
Binary files /dev/null and b/imgs/image-20250601220658402.png differ
diff --git a/imgs/image-20250601220748017.png b/imgs/image-20250601220748017.png
new file mode 100644
index 0000000..8b47b6a
Binary files /dev/null and b/imgs/image-20250601220748017.png differ
diff --git a/imgs/image-20250606171956311.png b/imgs/image-20250606171956311.png
new file mode 100644
index 0000000..af58fcb
Binary files /dev/null and b/imgs/image-20250606171956311.png differ
diff --git a/imgs/image-20250606214847373.png b/imgs/image-20250606214847373.png
new file mode 100644
index 0000000..a332cb1
Binary files /dev/null and b/imgs/image-20250606214847373.png differ
diff --git a/imgs/image-20250918195657365.png b/imgs/image-20250918195657365.png
new file mode 100644
index 0000000..3c1869c
Binary files /dev/null and b/imgs/image-20250918195657365.png differ
diff --git a/imgs/image-20250918195700453-1758196624047-1-1758196625750-3.png b/imgs/image-20250918195700453-1758196624047-1-1758196625750-3.png
new file mode 100644
index 0000000..3c1869c
Binary files /dev/null and b/imgs/image-20250918195700453-1758196624047-1-1758196625750-3.png differ
diff --git a/imgs/image-20250918195700453-1758196624047-1.png b/imgs/image-20250918195700453-1758196624047-1.png
new file mode 100644
index 0000000..3c1869c
Binary files /dev/null and b/imgs/image-20250918195700453-1758196624047-1.png differ
diff --git a/imgs/image-20250918195700453.png b/imgs/image-20250918195700453.png
new file mode 100644
index 0000000..3c1869c
Binary files /dev/null and b/imgs/image-20250918195700453.png differ
diff --git a/imgs/image-20250925180747838.png b/imgs/image-20250925180747838.png
new file mode 100644
index 0000000..f9de54e
Binary files /dev/null and b/imgs/image-20250925180747838.png differ
diff --git a/imgs/image-20251108205923125.png b/imgs/image-20251108205923125.png
new file mode 100644
index 0000000..def578b
Binary files /dev/null and b/imgs/image-20251108205923125.png differ
diff --git a/imgs/image-20251108205944930.png b/imgs/image-20251108205944930.png
new file mode 100644
index 0000000..68df8d0
Binary files /dev/null and b/imgs/image-20251108205944930.png differ
diff --git a/imgs/image-20251108205954246.png b/imgs/image-20251108205954246.png
new file mode 100644
index 0000000..9695ef0
Binary files /dev/null and b/imgs/image-20251108205954246.png differ
diff --git a/imgs/image-20251108210015132.png b/imgs/image-20251108210015132.png
new file mode 100644
index 0000000..4f8764c
Binary files /dev/null and b/imgs/image-20251108210015132.png differ
diff --git a/imgs/image-20251108210030562.png b/imgs/image-20251108210030562.png
new file mode 100644
index 0000000..e91a8e5
Binary files /dev/null and b/imgs/image-20251108210030562.png differ
diff --git a/imgs/image-20251108210036792.png b/imgs/image-20251108210036792.png
new file mode 100644
index 0000000..6511045
Binary files /dev/null and b/imgs/image-20251108210036792.png differ
diff --git a/imgs/image-20251108210057428.png b/imgs/image-20251108210057428.png
new file mode 100644
index 0000000..4a4ab4a
Binary files /dev/null and b/imgs/image-20251108210057428.png differ
diff --git a/imgs/image-20251108210112098.png b/imgs/image-20251108210112098.png
new file mode 100644
index 0000000..cecc995
Binary files /dev/null and b/imgs/image-20251108210112098.png differ
diff --git a/imgs/image-20251108210130819.png b/imgs/image-20251108210130819.png
new file mode 100644
index 0000000..d4df095
Binary files /dev/null and b/imgs/image-20251108210130819.png differ
diff --git a/imgs/image-20251108210146788.png b/imgs/image-20251108210146788.png
new file mode 100644
index 0000000..1afdca4
Binary files /dev/null and b/imgs/image-20251108210146788.png differ
diff --git a/imgs/image-20251108210159459.png b/imgs/image-20251108210159459.png
new file mode 100644
index 0000000..e6ad66f
Binary files /dev/null and b/imgs/image-20251108210159459.png differ
diff --git a/imgs/image-20251108210222716.png b/imgs/image-20251108210222716.png
new file mode 100644
index 0000000..752de4d
Binary files /dev/null and b/imgs/image-20251108210222716.png differ
diff --git a/imgs/image-20251108210235815.png b/imgs/image-20251108210235815.png
new file mode 100644
index 0000000..60b731a
Binary files /dev/null and b/imgs/image-20251108210235815.png differ
diff --git a/imgs/image-20251202135729648.png b/imgs/image-20251202135729648.png
new file mode 100644
index 0000000..334aec8
Binary files /dev/null and b/imgs/image-20251202135729648.png differ
diff --git a/imgs/image-20251205141751423.png b/imgs/image-20251205141751423.png
new file mode 100644
index 0000000..71acb27
Binary files /dev/null and b/imgs/image-20251205141751423.png differ
diff --git a/imgs/image-20260102104729767.png b/imgs/image-20260102104729767.png
new file mode 100644
index 0000000..4339627
Binary files /dev/null and b/imgs/image-20260102104729767.png differ
diff --git a/imgs/image-20260102110324837.png b/imgs/image-20260102110324837.png
new file mode 100644
index 0000000..2e6e27a
Binary files /dev/null and b/imgs/image-20260102110324837.png differ
diff --git a/三角机构/ARC.pdf b/三角机构/ARC.pdf
new file mode 100644
index 0000000..a0931a0
Binary files /dev/null and b/三角机构/ARC.pdf differ
diff --git a/三角机构/image-20251114112539697.png b/三角机构/image-20251114112539697.png
new file mode 100644
index 0000000..58c0447
Binary files /dev/null and b/三角机构/image-20251114112539697.png differ
diff --git a/三角机构/image-20251120225604227.png b/三角机构/image-20251120225604227.png
new file mode 100644
index 0000000..241adda
Binary files /dev/null and b/三角机构/image-20251120225604227.png differ
diff --git a/三角机构/三角期刊/三角时报永恒之泉.pptx b/三角机构/三角期刊/三角时报永恒之泉.pptx
new file mode 100644
index 0000000..f541592
Binary files /dev/null and b/三角机构/三角期刊/三角时报永恒之泉.pptx differ
diff --git a/三角机构/三角期刊/三角时报路霸(1)/三角时报路霸.png b/三角机构/三角期刊/三角时报路霸(1)/三角时报路霸.png
new file mode 100644
index 0000000..cca4cda
Binary files /dev/null and b/三角机构/三角期刊/三角时报路霸(1)/三角时报路霸.png differ
diff --git a/三角机构/三角期刊/三角时报路霸(1)/三角时报路霸.pptx b/三角机构/三角期刊/三角时报路霸(1)/三角时报路霸.pptx
new file mode 100644
index 0000000..0f8c9ba
Binary files /dev/null and b/三角机构/三角期刊/三角时报路霸(1)/三角时报路霸.pptx differ
diff --git a/三角机构/三角期刊/三角时报路霸(1)/路霸.pdf b/三角机构/三角期刊/三角时报路霸(1)/路霸.pdf
new file mode 100644
index 0000000..e550fe3
Binary files /dev/null and b/三角机构/三角期刊/三角时报路霸(1)/路霸.pdf differ
diff --git a/三角机构/三角期刊/三角时报路霸(1)/路霸.png b/三角机构/三角期刊/三角时报路霸(1)/路霸.png
new file mode 100644
index 0000000..0fabd96
Binary files /dev/null and b/三角机构/三角期刊/三角时报路霸(1)/路霸.png differ
diff --git a/三角机构/三角洲经理.md b/三角机构/三角洲经理.md
new file mode 100644
index 0000000..667e723
--- /dev/null
+++ b/三角机构/三角洲经理.md
@@ -0,0 +1,221 @@
+
+
+# 开场白
+
+
+
+宇宙本不应被观测。观测产生思想; 思想塑造现实。 大量相似思想的累积,或一个尤为强 大的单一思想,都可能对正确与真实 之物造成非自然的扭曲。我们将这些 扭曲称为异常体。 异常体极其危险。它们必须被捕获并 收容,以免其在现实中撕开缺口, 使我们暴露于任何凡俗心智都无法想象的、远为强大的力量面前。三角机构,一家为公共利益服务的私营企业,挺身应对此项挑战。
+
+
+
+我们的宇宙承载着许多相互竞争的利益。尽 管我们正努力提高这一数字,但三角机构目前在现实中所占的股份约为25% 所以我们投的是四面头。
+
+幸运的是,在其他的五个已知的未来中,我们占据 了整个市场 因此我们可以投掷6个四面头。
+
+
+
+
+
+异常的构成 焦点 领域
+
+
+
+普通手提箱
+
+
+
+波纹枪 3申惩
+
+19-22 24 26
+
+
+
+> 如何对付异常
+
+暂时满足其焦点(使其心满意足)
+
+说服它其行为适得其反(使其陷入困惑)
+
+移除其焦点的来源(使其陷入绝望)
+
+
+
+> 福利
+
+1. 特工可自动消耗每点伤害1点资质保证来无视该伤害的效果。具体的资质无关紧要。攻击或效果仍然会作用于您,旁观者也会看到其发生,但机构会将该伤害的结果转移到别处。别担心:您什么也感 觉不到
+2. 他们将进入嘉奖负债状态。通过获得嘉奖,直到特工 的总数达到零或以上,嘉奖负债便会移除。 处于嘉奖负债状态的特工将被自动纳入鞋带倡议,其鞋带会不时地自动 松开,作为一种温和的提醒,督促其脱离嘉奖负债状态。如果您通常不 穿带鞋带的鞋子,请将鞋带系在您身体的某个部位,以便体验该倡议的 全部益处
+
+1. 若复活一名特工不再符合成本效益,三角机构将为您的亲人 提供一小笔抚恤金和一份保密协议
+
+
+
+# 冰淇淋
+
+## 可选目标
+
+吃一碗幸运饼干 +1嘉奖
+
+在他人面前/让他人展示出少女心 +3嘉奖(每人一次)
+
+禁止说带有“好”的字 +3申戒
+
+## 路上事件
+
+- 人发现三角城最近举办了一场盛大的马拉松,所有人都在满怀笑意的进行这跑步,但似乎这场马拉松你上个月就已经在举行了
+- B发现上学的学生们一脸死气沉沉的走在路上
+- C上班路上看到一辆车偏离了车道。 --》无论如何,当事情 平息后,他们瞥见了原因:司机已经冻僵了,被 一层薄冰包裹着。他死了。
+
+## 开会
+
+最近城市有大量的人被气场冻结
+
+
+
+
+
+
+
+
+
+## 入场(练手)
+
+你们去泳池派对 但是门口有保安 你们该如何进去呢?
+
+
+
+## 进去以后
+
+### 找目标
+
+- 冰淇淋车
+- 询问了路人
+
+
+
+
+
+### 衣服不合身
+
+
+
+
+
+
+
+### 有人吃了冰淇凌冻住了
+
+
+
+
+
+
+
+
+
+## **特殊规则:**
+
+如果他们拿走任何零食并食用或使用,异常的特殊规则将启动:如果在任何时候他们的脉搏或体温显著升高,他们会开始冻结。最初这种感觉仿佛是一种巨大的解脱,但随后却会致命。对于特工而言,这表现为 2 点伤害,他们可以尝试使用能力或素质保证来避免这一效果。若他们开始奔跑或出汗,请务必提醒他们这一点。
+
+
+
+
+
+## 焦点
+
+解救炎热。这辆异常正借着冻结开始的那一刻汲取力量,但它不明白完全冻结人们并非必要。每当你觉得他们已安定下来,就开始冻结那些处于明显炎热情境中的人:晒太阳的人、在泳池旁奔跑的人、穿着过多衣物的人。那些刚才大声抱怨热的人?现在他们却冻得笑容满面。
+
+
+
+
+
+## **领域:**
+
+冰淇淋车的内部。特工们可以利用自己的能力进入车内,或者设法欺骗异常:如果他们大声抱怨太热,但又有理由拒绝享用零食,异常就会打开车门,让他们进入那冰冷的内部。记住,在内部混沌消耗的价值是原来的三倍。
+
+
+
+
+
+
+
+# 死寂
+
+
+
+## 晨会
+
+- 一位重要之人原计划去深夜酒馆跳舞, 但活动被取消了。又一次。
+- 特工的电视在播放他们最喜欢的节目时反复 静音,然后显示出小众街机游戏《太鼓达人》 的开场画面。
+- 一名特工不断在奇怪的地方发现扑克牌。这 些牌总是人头牌,而且牌上的人脸似乎总是 在尖叫。
+- 一位重要之人在一次重要活动前夕失声了。
+- 一名特工正要出门时,被电脑或其他设备的 电线绊倒,那些电线仿佛凭空出现一般。
+
+## 任务简报
+
+ 两周前,一个名为凯迪角的社区内报告了一起死 亡事件。当地一家名为双杰的酒吧老板之 一Tony Jackson被发现时,脸上凝固着痛苦的 表情,嘴巴张开仿佛在尖叫–,但死亡原因似乎 是突发性心脏骤停。
+
+ 上周,又报告了另一起死亡事件———一名 叫Manny Navarro的年轻男子在当地一家名为 Laundrocade的店铺里被发现,状态与前者相 同。
+
+ 这一巧合引起了机构的注意,并由此引出了 最新的发现: 凯迪角的居民们并不知道,昨晚在社区外又发现 了一具尸体———一名二十多岁的女性,表情与 前两名死者相同,身旁放着一袋金工工具。尸体 已死亡约一个月,是在对附近一块待开发土地进 行勘测时发现的。警方尚未开始调查她的身份, 而要确定其身份将十分困难。
+
+ 有什么东西正在那个社区里杀人,而机构希望在 谣言引起人们对异常体活动的关注之前,查明真相
+
+
+
+## 外观
+
+一个由纤细骨骼构成的牢笼,如同耳骨在装扮成 人形。从远处看,这个异常体可能像一具四肢修 长的骷髅:它白色、毫无特征的头部栖于蜂巢状 的身体之上,其身体之大,足以将一个人类包裹 于其核心之中。
+
+凑近观察会发现,异常体的手臂和腿没有真正的 关节,像老旧的电话线一样无力地从其核心垂 下。当它直立时,与其说是在行走,不如说只是 单纯地出现在更近的地方。当它四肢着地时,它 像狼一样向前跳跃,金属丝般的四肢在触及每一 寸新地面时伸长又缩短。
+
+
+
+
+
+## 双杰酒馆
+
+凯迪角的社区酒吧双杰酒馆,坐落在一栋低矮的砖砌建筑里,门上挂着一块简单的招牌。一块 用管道胶带粘在上面的手绘横幅写着“本市友好度第三的酒吧!”门外,一块黑板招牌的一面列出 了一周的活动,包括周一开放麦、周三单身派对之夜(特邀三手玫瑰乐队)以及DJ周五摇摆夜,所有这些活动都被划掉,并潦草地写上了“已取消”的字样。黑板的另一面写着“纪念l老杰最初的红心J。”
+
+
+
+### 入口
+
+双杰的门是一扇老旧的木门,顶部有个小 窗,曾被漆成扑克牌的模样,但大部分油漆已经 剥落。门上贴满了各种告示。 一张贴了太多免费剪贴画的广告:“汗流浃背? 臭气熏天?满身啤酒?快来刘艳洗衣, 每月可获赠价值5美元的街机代币!” 一张旧的街区派对传单:“本周末,The Station火力全开—6家本地摊贩,DJ泰迪G带来 劲爆音乐,还有比莉的全新金属雕塑!派对直到 黄昏!
+
+
+
+### 主厅
+
+双杰是一家老派的廉价酒吧,灯光昏暗, 角落阴影重重,地板发粘,木制家具的清漆正 在剥落。它比外面看起来要大,从房间右侧的吧 台一直延伸到一个中央木制舞池,舞池旁有一个 小DJ台,需要时可作为舞台。舞池尽头是卫生 间,旁边一扇门上标着“办公室”。除了酒吧工 作人员,里面只有寥寥几名顾客。士气低落。
+
+
+
+### 谢酒保
+
+ 谢能调制出他尝过的任何一种 饮品。他二十多岁时喝遍了各大酒吧,因此酒单 储备极为丰富,不过他总在寻求扩充。最近成了 品茶鉴赏家。他怕虫子怕得要死,所以总想在不 失廉价酒吧氛围的前提下,把店里打扫得尽可能 干净。两周前托尼死在吧台后,他一直急着想把 那里彻底打扫一遍(只要能得到杰姬的允许)。 特工们抵达时,他正在离门最远的半边吧台后工 作。另一半吧台已被封锁;那里是托尼死去的地 方。
+
+特工们可以通过点单并与谢里夫交谈,了 解到以下信息:
+
+ 托尼值夜班时总是喝根汁汽水。
+
+卫生间里有个看起来像蜘蛛的东西在动。 那东西让他感觉很不好,但总是在被抓住 前就飞快地溜走了。
+
+
+
+
+
+### 舞池
+
+舞池后方有一个小DJ台,里面放着音响系统。 没人试着去修理它。靠近音响系统会让人感 觉毛骨悚然。 使用追踪异常共鸣的方法会发现一条微弱的踪迹 从音响通往卫生间,一条明显的踪迹通往吧台后 托尼死去的地方,然后延伸至前门,并在那里消 散得无法追踪。
+
+
+
+### 卫生间
+
+进入卫生间需要从杰姬或谢里夫那里拿到钥匙。 里面是一个单间和一些老派的卫生间涂鸦。一 个由双杰音响电线制成的线灵正蹲在角落 里,像一只长腿蜘蛛。 如果被接近或对峙,它会逃到主厅(如果有足够 的混沌,则会变为闪电线灵),并攻击酒吧工作 人员和顾客,很可能会制造出散逸端。
+
+
+
+### 杰姬
+
+杰姬曾是一名爵士歌 手,后来她那沙哑的嗓音不知是因为开始吸烟还 是戒烟而消失了———她的说法每次都不同。她 和前夫共同拥有双杰近20年。所有人都以 为酒吧的名字取自他们俩的名字,但实际上是她 在一次二十一点牌局中从前任老板手里赢来的。 大约两周前,她发现了死在吧台后地板上的托 尼,他嘴巴张开,仿佛在尖叫。杰姬坚信是某种 东西杀死了托尼。 特工们抵达时,她正在酒吧的办公室里(一间位 于卫生间后方、没有窗户的小房间,墙上贴满了 扑克牌)处理他死后产生的一些文书工作。她偶 尔会出来找谢里夫要冰茶,并向他抱怨没人把托 尼或曼尼·纳瓦罗的死当回事。 杰姬希望市政能对她收集到的所有关于托尼之死 的证据进行官方调查,并希望能在坏掉的音响上 再听一次他最喜欢的歌曲《两张J换一张Q》。
diff --git a/三角机构/以撒的结合.md b/三角机构/以撒的结合.md
new file mode 100644
index 0000000..434f9e8
--- /dev/null
+++ b/三角机构/以撒的结合.md
@@ -0,0 +1,339 @@
+
+
+
+
+
+
+# 异常体档案 罪恶
+
+
+
+
+
+| 值 | 名称 | 效果(供KP叙述与判定) |
+| ---- | ---------- | ------------------------------------------------------------ |
+| 2 | 腐化 | **苹果中的剃刀**:任意一名最近“获得好意”的目标,在吃东西或喝水时,发现口中出现异物——如玻璃碎片、剃刀片、针等。造成1伤害 |
+| 3 | 现实触发器 | **罪的重演**:目标周围出现与以撒记忆相似的小细节——教室里多出一张他从未画过的“被欺负”的画、母亲责备的耳语、赌徒的笑声等。首次发生时,所有在场特工进行一次低难度理智检定,失败者会在片刻间坚信:**“我以前也这样伤害过别人 / 被这样伤害过。”** |
+| 5 | 吸引 | **拜访以撒**:镇民(或重要之人)开始做同一个梦:他们爬上山,来到以撒的房间,对着箱子倾诉自己的罪,醒来时记不清细节,只记得很累。KP可借此安排 NPC 主动来“找以撒”,把线索送上门。 |
+| 6 | 双重 | **暴食 & 贪婪(次级异常)**:在场中随机两人各被附着一个次级异常: · 暴食:每隔数轮(现实中 2 分钟左右),必须用一个行动吃东西、喝酒、吞药等;若无法满足,则受1伤害,并产生失控暴食行为。 · 贪婪:强迫性地想把所有金币、小物件、甚至他人的装备收入囊中。拒绝则受1伤害。 |
+| 8 | 扩张 | **以撒化**:异常开始迅速扩散。越来越多的居民(甚至特工)出现“以撒化”症状: · 文件里名字被改成“以撒”; · 镜子里看到的是以撒的脸; · 他人的记忆会被“修正”为:**“你一直是那个带来不幸的人。”** 若不遏制,整个镇会逐渐变成一个由无数个“以撒”组成的伪家庭。 |
+| 9 | 三重 | **四骑士复苏**:以撒的“四骑士”以四种场景或NPC形态出现,可分配给四个不同的人或地点: · 战争:某人突然极度暴力,对小事大发雷霆,随时动手; · 瘟疫:某人皮肤溃烂、高烧不退,医检无明确原因; · 饥荒:大量食物瞬间腐烂、长蛆;与“暴食”组合时形成可怕的“吃腐烂物冲动”; · 死亡:环境本身变得致命,“稍有不慎就会暴毙”(楼梯塌陷、车祸、坠物等)。 |
+| 10 | 抹杀 | **妈腿**:一条异样粗大、臃肿、带着裙边的女性腿,从天花板轰然砸下,对目标造成高额3伤害。被砸中的人还会听到母亲的尖叫与祷告在脑内回荡。 |
+| 30 | 罪我 | **终极自责**:特工彻底被异常吞噬,产生强烈的信念: “这一切的一切,都是因为我。如果我从世界上消失,就能结束。”该目标会尝试以任何方式让自己“被抹去”(可以是自残、自我牺牲冲向异常核心,被箱子收入等,由 KP 用剧情方式呈现),并将自己一起投喂给宝箱。``几乎无法避免`` |
+| | | |
+
+## 晨会
+
+可从中挑 1–2 条作为开场预兆:
+
+- 一名特工的好友因赌博欠下一屁股债,被高利贷追着跑,嘴里一直念叨:
+
+ > “要不是我孩子出生,我也不会这么穷……”
+
+- 一名特工突然**异常想念自己的母亲**,甚至在简报时走神,脑中反复闪回童年被责骂或被保护的画面。
+
+- 某特工的手机随机弹出一条新闻推送:
+
+ > “山顶小屋男童十年前失踪案——警方认定为家庭纠纷后离家出走。”
+ > 配图是一座孤零零的房子和模糊的小男孩背影。
+
+## 历史
+
+**· 赌场线索(父亲)**
+
+- 赌场老板和常客会提到:以撒的父亲是这里的常客,
+ - 经常偷家里钱来赌博,连儿子的储蓄罐都砸了;
+ - 欠下一屁股债后消失,有人说他“卷钱跑路”,有人说他“被人做掉了”。
+- 特工可以在赌场获得:
+ - 父亲的名字、旧照片;
+ - 账本里他名字边上被画上的小十字架和涂黑痕迹(暗示他对家中“罪”的贡献)。
+
+**· 教堂线索(母亲)**
+
+- 神父会承认:
+
+ - 以撒母亲长期遭受丈夫语言与肢体暴力;
+ - 在丈夫离开后精神崩溃,整天看宗教电视节目,坚称自己“听见上帝要她净化孩子”。
+
+- 教堂资料室里可以找到**母亲的忏悔书原件**,边角沾有药粉和泪痕。
+
+- 老教友会说:
+
+ > “她常说,以撒是天生的坏种,是罪的源头。”
+
+**· 学校线索(欺凌)**
+
+- 老教师或同学会提到:
+ - 没人愿意和以撒同桌;
+ - 他的东西经常被藏、被丢;
+ - “那孩子总是道歉,什么都说是自己的错。”
+- **走廊墙绘**就是关键证据:
+ - cv一整面墙被儿童画覆满,以撒被各种方式欺负、塞进柜子,被画成“坏事的影子”;
+ - 还有那一幅**女孩递苹果给以撒**的画,旁边有人涂写:“他活该”。
+
+**· 苹果与剃刀事件(异常的起点)**
+
+- 以撒曾经好不容易得到一个女孩送的苹果;
+
+- 咬下去时,发现里面埋着一片剃刀片,**嘴被划烂,满嘴是血**;
+
+- 老师只是让他“以后吃东西小心点”,没有追究是谁干的;
+
+- 那天之后,以撒开始彻底相信:
+
+ > “连好意和礼物也是带着刀的,是因为我该受罚。”
+
+
+
+## 焦点
+
+**以撒**与“罪”的认知:
+ 他真心相信——家庭所有的不幸、争吵、暴力和离散,**都是因为他**。
+ 在异常看来,**任何把一切过错都扛到自己身上的人,都可以成为“新的以撒”**。
+
+## 领域
+
+一个能装下一个小孩大小的卡通金色宝箱,外表像儿童玩具:圆鼓鼓的箱体,夸张的大锁扣,上面画着哭泣的卡通脸和小十字架。
+
+在山顶小屋里的以撒房间正中央,紧贴墙角的儿童床前。
+
+从外面看只是普通深度;
+
+实际上内部是一个**“罪的囚室”**——像游戏里的地下层一样无尽向下延伸,墙上贴满儿童画、忏悔纸条和撕碎的家庭照片。
+
+被拖入宝箱内部的人,会在这里反复经历“被指责、被抛弃、被称为罪的根源”的记忆(有自己的,也有以撒的)。
+
+**开启条件:**
+
+- 在以撒房间里,有人:
+ - 大声说出“都是我的错”,
+ - 或者指着别人说“都是你的错”;
+- 或对着宝箱**流泪 / 忏悔 / 自残**(可以只提“伤害自己”,具体由pl演出,不用写方法)。
+
+
+
+- **效应:**
+ - 房间门自动上锁,外面声音变得模糊;
+ - 宝箱在地上拉出一圈“泪水形状”的水渍,形成领域边界;
+
+
+
+
+
+## 冲动
+
+> **把一切“罪”收纳进自己,直到世界上只剩下“我这个罪人”。**
+
+触发行为:
+
+- 当特工/居民 **把错误推给别人** ——
+ “都是你的错,是你害的。”
+- 或者当某个人说:
+ “是我的错...”
+
+异常体会立刻察觉并尝试:
+
+1. 把那段“罪”刻进目标记忆,让目标逐渐**相信自己就是所有事情的源头**;
+2. 若目标抵抗,宝箱会尝试**改写周围人的记忆**,让所有人开始一起指责他。
+
+## 外形
+
+从远处看,它只是一个**金黄色的卡通宝箱**,静静待在原地。但靠近时,会逐渐显露出“活物”的特征:
+
+- 箱盖内侧有两道水渍,像是**倒挂的眼睛**,偶尔会眨动;
+
+- 箱身表面的卡通图案会缓慢变形,变成以撒的脸、母亲的脸、特工熟人的脸,嘴巴不断重复一句:
+
+ > “都是你的错。”
+
+ 
+
+1.
+
+## 可选任务
+
+**+1 嘉奖**:向陷入自责的人真诚伸出援手(现实的、有效的,而非敷衍安慰)。
+
+**+3 嘉奖**:成功让至少一个 NPC 意识到“这不是他的错”,从自我憎恨中走出来。
+
+**+1 申诫**:进行一场有实际赌注的赌博行为(包括赌场、暗箱操作、用生命/他人安全做赌注)。
+
+## 当前状况
+
+以撒生活在山顶上的小房子里,与父母相依为命。然而父母关系破裂,父亲经常争吵并偷窃家里财物,最终离家出走。母亲因失去丈夫和家庭暴力而精神失常,沉迷于基督教电视节目和毒品,她听到“来自上天的声音”认为以撒被罪恶腐蚀,于是夺走他的所有玩具和衣物并将他锁在房间中。
+
+刚开始以撒只是觉得罪在自己于是把自己封闭在房间里面哭泣
+
+结局岔路:
+
+- **善终线**:
+
+ - 特工设法说服(或抱着)以撒,告诉他:错的不是他,而是这个世界(bushi)
+ - 若特工只是在逻辑层面推理,而**没有任何人真正试图安放以撒的罪与痛** 以撒基本无法相信
+ - 回收或封印宝箱;
+
+- **恶化线**:
+
+ - 以撒完全被“罪我”吞噬,成为堕落以撒;
+
+ - 宝箱转移领域,跟着堕落以撒去到别的城市,模组结局写一句:
+
+ > “以撒只是第一个。他不会是最后一个。”
+
+## 母亲的忏悔书
+
+抱歉以撒,我的孩子,我十分爱你。但是我听到了上帝的呼唤,抱歉孩子,我要向上帝证明我爱他胜过爱你。我听见那声音从电视机里钻出来,它说你被罪恶腐蚀,需要被拯救。我锁起房门,是想保护你不再受到外面恶魔的诱惑。
+
+可是那些yao-,那些让我暂时忘记痛苦的--,让我看到更多的幻影。我看见天使挥舞火焰的剑,也看见恶魔藏在你的笑容里。我知道这是试炼,是上帝在考验我是否愿意献出最爱的人来证明对他的信仰。
+
+我曾经握着刀站在你的小床旁,泪水滴在你的额头。我祈祷xx,但xx和祷告交织在一起,变成了低语与幻觉。
+
+如今,我的手一直在颤抖,心里却有一种奇异的平静。也许这是上帝赐予的慈悲,也许只是那些药物让我麻木。我写下这些话,只是想让你知道,无论我做了什么,我都带着母亲的爱。正是因为这爱,我才相信把你奉献给主是唯一的救赎。
+
+主爱世人,我爱你(你被划掉),我爱主!!!
+
+## 学校的墙
+
+1.走廊那面墙并不像是普通的“宣传板”,更像是一块被孩子和恶意一起撕扯过的皮肤。蜡笔、粉笔、圆珠笔全都糊在上面,层层叠叠,最后只剩下同一种东西——以撒被欺负的画面。
+
+这些绘画看上去并不是一次画成的,而是被反复涂改、覆盖。某一张图上,以撒原本只是在桌子边掉眼泪,但后来有人又用黑笔把他的影子拉得很长,拉到整个教室中央,(好像他成了所有不幸的“根源” 不用跟特工说出来);另一幅里,他的脸被重新画了好几层,最后模糊成一个没有五官的肉团,只剩下大颗的蓝色泪点滴落。
+ 红色、黑色、深蓝色反复交错,有的地方纸已经被磨破,露出后面的水泥墙皮。远远看去,这些画连成一整片阴影,像是一群孩子把所有对以撒的恶意一层层钉死在墙上,生怕有一天他会从墙里爬出来,把这些记忆拿走。
+
+2.以撒曾经获得过一个女孩的苹果,但是当他吃下去的时候,发现里面有一个剃刀....他的嘴被划破了
+
+
+
+## 赌场赌徒
+
+特工刚靠近吧台,就听见旁边几个人在大笑。一个秃顶的老赌徒晃着杯子,眼皮半垂,醉意上头,话却越来越放肆:
+
+> “你们还记得那个……叫什么来着?哦,对,那个整天抱着圣经的疯女人的老公。”
+> “就是那个小鬼他爸,长得瘦瘦的,总爱穿一件旧西装。啧,那家伙可真会赌。”
+
+另一个赌徒哼了一声,把筹码往桌上一推:
+
+> “会赌?他那叫偷命来赌。每次来这儿都说什么‘最后一把’,结果第二天又蹿回来。你们没看见啊,他掏钱那眼神,比我们都急。”
+
+秃顶的老赌徒凑近,压低了声音,像是在说一个好笑又理所当然的秘闻:
+
+> “他哪来的钱?家里那个疯女人哪舍得给?
+> 他就从家里偷——先是老婆钱包里的现金,后来连家里储蓄罐都砸了。
+> 我还亲眼看见过一次,他拿着一个小孩的存钱罐来换筹码,里面全是硬币,叮当一倒,全是血汗呢。”
+
+旁边有人跟着笑:
+
+> “小鬼的血汗钱呗。那小鬼叫什么?以撒?
+> 听说他妈发现钱不见了,就更疯了——成天嚷嚷什么‘罪’啊‘试炼’啊。哈哈,这种家里出来的问题孩子,迟早出事。”
+
+老赌徒抖了抖烟灰,似乎还想再补一刀:
+
+> “别这么说,他爸也可怜啊。
+> 在家天天吵架,女人整天对着电视祷告,他就只能来这儿。
+> 偷点钱,赌两把,输光了再偷。啧,这个镇子不就这样?
+> 谁没有点见不得光的小动作?”
+
+说到这儿,几个人又齐声大笑,把“偷家里钱来赌博”当成再普通不过的笑谈。
+ 在他们嘴里,以撒的父亲不是什么“罪人”,只是个“赌狠了点的普通男人”;而被偷走的,是一个家庭最后一点摇摇欲坠的安全感,是一个孩子本该属于自己的、唯一的存钱罐。
+
+
+
+## 补充
+
+作者的话:这个异常体基本就是按照游戏《以撒的结合》游戏背景故事写的
+
+各位经理们可以根据我下面的背景介绍增加内容
+
+**母亲被宗教和毒品洗脑 → 上帝的声音 → 献祭儿子;**
+
+**父亲赌博、逃避、失职 → 赌场线索;**
+
+**学校欺凌 → 墙上的画、苹果和剃刀;**
+
+**以撒把一切罪归到自己身上 → 宝箱、罪的领域、‘我就是罪’的焦点。**
+
+
+
+
+
+### 一、开端设定:山顶小屋与“上帝的声音”
+
+- 以撒(Isaac)和母亲住在山顶的一间小房子里。
+ - 以撒在房间里画画、玩玩具;
+ - 母亲整天看电视上的基督教节目,是那种非常虔诚、但也有点偏执的信徒。
+- 某一天,母亲听到“来自上天的声音”,她相信那就是上帝:
+ 1. 第一次,声音说:**“你的孩子被罪恶腐蚀,需要被拯救。”**
+ 她于是把以撒的玩具、画本、甚至衣服都拿走,说要“除去罪恶”。
+ 2. 第二次,声音说:**要让他与世上所有邪恶隔绝。**
+ 母亲于是把以撒锁在房间里,不让他见任何人。
+ 3. 第三次,声音说:**她做得很好,但为了证明信仰,还必须献祭自己的孩子。**
+ 母亲拿起厨房里的大刀,准备去杀掉以撒,以示对“上帝”的绝对忠诚。
+- 以撒透过房门缝看到母亲拿刀走来,惊恐之下,在地毯下发现一扇隐藏的活板门,于是跳进地下室——**游戏就从这里正式开始**:
+ 每一条新路线(新一局游戏)都可以理解为:以撒再次跳下去后,在地下世界展开的另一次尝试。
+
+------
+
+### 二、地下旅程:一层层接近“母亲”
+
+游戏是类 Roguelike 的结构,但从**故事线**来看,可以粗分为几大阶段:
+
+- 在经典路线中,中后期的关键 Boss 是:
+ - **Mom(妈腿)**:一条巨大的女性腿不断从天花板砸下。
+ - 更深处是 **Mom’s Heart / It Lives**(母亲的心脏 / 它活着),象征他杀死或试图“超越”母亲控制。
+- 打败 Mom 后,以撒继续往更不可理解的空间前进。
+
+1. **后期路线:天堂、地狱、教堂、黑暗房间**
+ 随着解锁和 DLC,故事分支越来越多:
+ - **Sheol / The Cathedral**
+ - 走“地狱”线会与 Satan 战斗;
+ - 走“教堂”线则会上到 Cathedral,与“Isaac / ???”之类的自我形象战斗。
+ - **The Chest / Dark Room**
+ - 进一步的隐藏关卡:“宝箱”和“黑暗房间”,Boss 变为 **The Lamb** 等,暗示更深层的罪与救赎意象。
+ - 最终在 Repentance 路线中,还加入了另外一条极长的分支,更直接地触及“父母、家庭破裂与自我毁灭”的主题。
+
+------
+
+### 三、多结局结构:碎片化的记忆与暗示
+
+原版 + 扩展 + 重制版里有非常多结局动画
+
+- 前面很多结局只是**解锁道具、角色或新机制的引导**;
+- 真正与剧情有关的结局,会反复出现这些元素:
+ - 家庭合照、以撒的房间、宝箱、画本;
+ - 以撒蜷缩在角落里哭泣的样子;
+ - 母亲的阴影,父亲离开的身影;
+ - 以撒画出的另一个“自己”(蓝宝宝、罪我等)。
+
+这些结局并没有给出一个“官方唯一答案”,而是故意留白,让玩家自己去拼。
+
+------
+
+### 四、故事常见解读(官方留白 + 玩家推测)
+
+因为作者 Edmund McMillen 本人也说过,他想用这个游戏去谈自己对宗教和家庭的感受,而不是给一个标准答案,所以社区里有几个主流解读:
+
+1. **现实世界 + 脑内幻想混合说**
+
+ - 开头那段“母亲听到上帝的声音”多半是真实的——她是因为宗教狂热 + 精神问题,真的想杀孩子;
+ - 以撒跳进地下室后发生的一切,更像是他**在恐惧、濒死或长期虐待中构建的幻想世界**:
+ - 怪物 = 他眼中的大人、同学和自己的身体;
+ - Boss = 对母亲、对自己罪恶感的具象化。
+
+2. **宝箱窒息 / 自我封闭说**
+
+ - 部分结局暗示:以撒可能躲进一个箱子或衣柜,把自己关起来,最后在里面死去;
+ - 游戏过程 = 他临死前不断重播的记忆与幻想,或者是他用来合理化自己遭遇的一套“地狱冒险”剧情。
+
+3. **家庭破裂与父亲的缺席**
+
+ - 后续资料和访谈都提到:父亲离家与酒精、金钱有关,家里的争吵、贫穷和暴力,构成了以撒的童年背景。
+
+ - 游戏中的爸爸道具、家庭合照撕裂等画面,都是在不断提醒:
+
+ > 这个孩子并不是只被“宗教母亲”伤害,而是被整个破碎家庭一起推向绝境。
+
+4. **主题:宗教恐惧 + 自我厌恶 + “原罪感”**
+
+ - 游戏的关键不是讲一个线性的“从 A 到 B 的故事”,而是让你反复处在:
+ - “我是不是天生就有问题?”
+ - “大人说我是罪的来源,那我是不是干脆变成怪物算了?”
+ - 所有道具名字、敌人形象、Boss 设计都围绕“七宗罪”“忏悔”“献祭”“母体”和“胎儿”的意向不断循环,强化这种压抑感。
\ No newline at end of file
diff --git a/三角机构/战报模板.pptx b/三角机构/战报模板.pptx
new file mode 100644
index 0000000..71cffd4
Binary files /dev/null and b/三角机构/战报模板.pptx differ
diff --git a/三角机构/永恒之泉.md b/三角机构/永恒之泉.md
new file mode 100644
index 0000000..e24f83e
--- /dev/null
+++ b/三角机构/永恒之泉.md
@@ -0,0 +1,54 @@
+
+
+位于三联城市中心的奢华医疗水疗中心“源泉”,最近推出了一款名为“奥可菲”的新系列产品—— 一套高效且广受欢迎的抗衰老护肤品。这些产品带有一系列不寻常的副作用:灵魂出窍体验、闪回从 未发生过的事件、一阵阵无法抗拒的忧郁…——而这仅仅是个开始。原因是:这些产品由一种被囚禁 在“源泉”地底深处的异常体的提取精华制成。如果任其发展,这个植物形态的异常体的影响力将在 城市中扩散,引诱越来越多的人在它迅速扩张的领域中走向死亡。
+
+
+
+## 历史
+
+ 这种异常体以某种形式存在了数百年,稳定地以 人类阻止时间无情脚步的欲望为食。它诞生于 16世纪初,源于胡安·庞塞·德莱昂在今日佛 罗里达的丛林中寻找青春之泉的传说。那些探险 家实际上找到了一个拥有他们所寻求力量的异常 体–——但他们对此一无所知。他们烧毁了它和 它的森林,以建立一个定居点。这个异常体的第 一次生命以悲剧、记忆的丧失和家园的毁灭而告 终。
+
+ 它进入了休眠状态,但并未死亡。人类从未停止 对逝去时光的渴望,所以它的焦点使其在死亡边 缘得以保存。随着社交媒体的出现,以及人们对 衰老的恐惧日益绝望,这个异常体再次开始茁壮 成长–——这一次,它从其森林旧址的人行道裂 缝中发芽。
+
+ 三年前,关于在佛罗里达一个停车场发现一种奇 怪新植物的传闻,传到了源泉的财务与分销总监 Olive Huynh(她/她的)耳中。她不是个会放过 潜在商机的人,便利用自己的人脉关系网取得了 这株植物,并将其带到三联城,用于新产品的开 发。她派出了值得信赖的朋友,也是源泉的水疗 协调员Serena Evermore(她/她的),亲自去 取回这株植物。 当Serena进入那个被藤蔓扼住、异常体安家于 此的停车场时,她便知道这不是一株普通的植物。当一根好奇的卷须缠绕上她的手指时,她理解了它,它也理解了她。她感受到了它的悲伤, 它对祖居之地的渴望,并与之感同身受。她也同 样在寻找自己的根。异常体感觉它认识她。但它 想不起来为什么
+
+异常体相信Serena能帮它记起过去,便自愿来 到了源泉。在这里,开发团队为它搭建了一个特 殊的围场,供其茁壮成长。多年来,他们研究出 一种可持续的方法,将其汁液、果实和叶片蒸馏 成一种具有强大焕活功效的强效产品–——但在 为它寻找新家方面却毫无进展。 现在,它变得焦躁不安。Serena没有遵守为它 寻找家园的承诺。经过多年的等待,异常体准备 采取行动了。
+
+
+
+## 焦点
+
+人类想要回到某个–或某个自我–的欲望,而那时 光或自我已然无法挽回地失去了。
+
+
+
+## 领域
+
+在三联城下方的下水道系统中萌发的一片雨林———这是对异常体最初诞生地的一份复制品,在那之后,一群16世纪的探险家将其烧为平地。
+
+
+
+## 外观
+
+异常体表现为一株西番莲藤,目前缠绕在源泉一 个玻璃笼内的棚架上。它会长出圆形光滑的果 实、宽大的紫色花朵,偶尔还会长出含泪不眨的 眼睛。它的捕捉者们不知道的是,这只是异常体 的一部分。几个月前,它在灌溉系统中发现了一 个微小的开口,并将一根匍匐茎延伸至下水道, 在那里建立了它的领域
+
+
+
+## 冲动
+
+在三联城地下的下水道系统中完全重建它的家 园。如果置之不理,这片地下丛林将延伸至城市 的供水系统,将其卷须植入所有三联城居民体 内。当它积蓄了足够的力量,它将把他们的身体 弯折到断裂点,在一场花与藤蔓的爆炸性展现中 将人们撕裂–——这股生长浪潮将把整座城市变 成它失落已久的家园。
+
+## 当前状况
+
+异常体的力量随着每个使用奥可菲产品的人而增 长。使用这些产品会让异常体在他们的思想中扎根,扭曲他们的记忆,并以他们的欲望为食。其影响集中在商业大道周围,那里是源泉及其主要店面的所在地。在异常体的控制下,一整片雨林 已经在大道下方的下水道中生长起来。
+
+
+
+
+
+## 晨会
+
+- 一名特工的伴侣兴奋地分享了他们期待已久 的水疗日计划。
+- 一名特工突然收到了来自遥远过去一位重要 人物的联络。
+- 演员Jay Hsieh似乎无处不在———电视广 告、社交媒体、广告牌、杂志———为他与 源泉奥可菲的合作大肆宣传。
+- 一群年轻人走过,他们似乎都长着同一张 脸。
\ No newline at end of file
diff --git a/三角机构/特工表.pdf b/三角机构/特工表.pdf
new file mode 100644
index 0000000..d9a87ce
Binary files /dev/null and b/三角机构/特工表.pdf differ
diff --git a/三角机构/行动审查/三角时报永恒之泉.pptx b/三角机构/行动审查/三角时报永恒之泉.pptx
new file mode 100644
index 0000000..73ca02e
Binary files /dev/null and b/三角机构/行动审查/三角时报永恒之泉.pptx differ
diff --git a/三角机构/规则书/三角机构/三角机构-Triangle Agency-核心规则书-V1.0-V11.12.pdf b/三角机构/规则书/三角机构/三角机构-Triangle Agency-核心规则书-V1.0-V11.12.pdf
new file mode 100644
index 0000000..a30e6c0
Binary files /dev/null and b/三角机构/规则书/三角机构/三角机构-Triangle Agency-核心规则书-V1.0-V11.12.pdf differ
diff --git a/三角机构/规则书/三角机构/三角机构-收容库The Vault 9-15-25-v11.12.pdf b/三角机构/规则书/三角机构/三角机构-收容库The Vault 9-15-25-v11.12.pdf
new file mode 100644
index 0000000..6c35818
Binary files /dev/null and b/三角机构/规则书/三角机构/三角机构-收容库The Vault 9-15-25-v11.12.pdf differ
diff --git a/三角机构/规则书/三角机构/三角议程Triangle Agenda Interior .pdf b/三角机构/规则书/三角机构/三角议程Triangle Agenda Interior .pdf
new file mode 100644
index 0000000..3d9b128
Binary files /dev/null and b/三角机构/规则书/三角机构/三角议程Triangle Agenda Interior .pdf differ
diff --git a/三角机构/规则书/三角机构标准报告表 中译鸦版.pdf b/三角机构/规则书/三角机构标准报告表 中译鸦版.pdf
new file mode 100644
index 0000000..b04fd80
Binary files /dev/null and b/三角机构/规则书/三角机构标准报告表 中译鸦版.pdf differ
diff --git a/三角机构/规则书/三角议程.pdf b/三角机构/规则书/三角议程.pdf
new file mode 100644
index 0000000..af96192
Binary files /dev/null and b/三角机构/规则书/三角议程.pdf differ
diff --git a/三角机构/规则书/公司补给.pdf b/三角机构/规则书/公司补给.pdf
new file mode 100644
index 0000000..7f63ecb
Binary files /dev/null and b/三角机构/规则书/公司补给.pdf differ
diff --git a/三角机构/规则书/收容库.pdf b/三角机构/规则书/收容库.pdf
new file mode 100644
index 0000000..6d942cf
Binary files /dev/null and b/三角机构/规则书/收容库.pdf differ
diff --git a/三角机构/规则书/核心规则书.pdf b/三角机构/规则书/核心规则书.pdf
new file mode 100644
index 0000000..0a3598c
Binary files /dev/null and b/三角机构/规则书/核心规则书.pdf differ
diff --git a/三角机构/规则书/模组表/路霸.pdf b/三角机构/规则书/模组表/路霸.pdf
new file mode 100644
index 0000000..8ab233a
Binary files /dev/null and b/三角机构/规则书/模组表/路霸.pdf differ
diff --git a/三角机构/规则书/模组表/路霸.ppt b/三角机构/规则书/模组表/路霸.ppt
new file mode 100644
index 0000000..fd3edbd
Binary files /dev/null and b/三角机构/规则书/模组表/路霸.ppt differ
diff --git a/三角机构/角色卡/“双叶”塞斯和艾拉.xlsx b/三角机构/角色卡/“双叶”塞斯和艾拉.xlsx
new file mode 100644
index 0000000..114c022
Binary files /dev/null and b/三角机构/角色卡/“双叶”塞斯和艾拉.xlsx differ
diff --git a/三角机构/角色卡/三角机构.大卫'戴.xlsx b/三角机构/角色卡/三角机构.大卫'戴.xlsx
new file mode 100644
index 0000000..9ac5e4d
Binary files /dev/null and b/三角机构/角色卡/三角机构.大卫'戴.xlsx differ
diff --git a/三角机构/角色卡/凯恩.xlsx b/三角机构/角色卡/凯恩.xlsx
new file mode 100644
index 0000000..8c2e08c
Binary files /dev/null and b/三角机构/角色卡/凯恩.xlsx differ
diff --git a/三角机构/角色卡/李斯·孙卿.xlsx b/三角机构/角色卡/李斯·孙卿.xlsx
new file mode 100644
index 0000000..8a8c6e9
Binary files /dev/null and b/三角机构/角色卡/李斯·孙卿.xlsx differ
diff --git a/三角机构/角色卡/琳达梅尔.xlsx b/三角机构/角色卡/琳达梅尔.xlsx
new file mode 100644
index 0000000..da8a537
Binary files /dev/null and b/三角机构/角色卡/琳达梅尔.xlsx differ
diff --git a/三角机构/角色卡/瑞克·戴克.xlsx b/三角机构/角色卡/瑞克·戴克.xlsx
new file mode 100644
index 0000000..6458047
Binary files /dev/null and b/三角机构/角色卡/瑞克·戴克.xlsx differ
diff --git a/三角机构/角色卡/里昂(汲取 海王 CEO).xlsx b/三角机构/角色卡/里昂(汲取 海王 CEO).xlsx
new file mode 100644
index 0000000..219a9bb
Binary files /dev/null and b/三角机构/角色卡/里昂(汲取 海王 CEO).xlsx differ
diff --git a/三角机构/路霸.md b/三角机构/路霸.md
new file mode 100644
index 0000000..a3de219
--- /dev/null
+++ b/三角机构/路霸.md
@@ -0,0 +1,226 @@
+# 路霸
+
+## 异常体档案
+
+三联城臭名昭著的拥堵地段——胜利环岛,启用了一套全新的交通控制系统:路霸,一个由传感器塔 和配套应用组成的系统,取代了该社区传统的停车标志和交通信号灯。公众并不知道,这套系统完全 由一个与被囚禁的共鸣者韦恩结合的异常体所控制。韦恩被三角机构的经济对 手、跨国科技集团米洛斯工业捕获,并被囚禁在路霸塔内。 韦恩的异常体受命于自动化三联城的早晚高峰交通,却发现自己对此毫无准备,于是它采取了一种可 怕的捷径:将有问题的司机传送到数百米的高空,关入封闭的“循环域”中,这样他们就再也不会堵 塞三联城的道路了。
+
+
+
+
+
+## 历史
+
+米洛斯工业在员工中发现了一名拥有缺位能力的共鸣者,而机构对此毫不知情。此人若无干预, 将会变成一个异常体。米洛斯预测异常体的最终 形态将取决于安德鲁转变时的心智状态,于是他 们使用实验性疗法,确保异常体的焦点会变成 “让交通消失”。当他的转变进展到足够程度 时,他们便将安德鲁安置在了路霸收容单元中。 米洛斯首席执行官埃里克·莫纳汉(他/他的) 与州长戴安娜·阿尔瓦雷斯(她/她的)达成协 议,在三联城以交通拥堵闻名的商业区部署路霸 交通管理系统,尽管公众抗议称基于智能手机的 系统具有排他性,且容易出故障。州长急于赢得 受交通影响最严重的郊区选民的支持,而莫纳汉 则急于挑战三角机构对三联城的经济扼制,该项 目因此进展迅速。 沟通不畅和对如何参与的普遍误解,已使该地区 的交通状况更加恶化。过去几天对司机们来说简 直是一场噩梦:没有信号灯或标志,那些无法辨 别应用通常含糊不清指令的人,被迫卷入一场万 人的胆小鬼博弈。异常体本身也加剧了混乱:在 某些情况下,司机被指示穿过人行道和建筑大 堂
+
+
+
+
+
+## 焦点
+
+米洛斯团队已成功将异常体的焦点转变为“让交 通消失”,这也是米洛斯用于推广这项新服务的营销口号。该营销活动以一只名为路霸的酷炫卡通猪为主角,动画广告中描绘了他 借助巨大的鼻子和獠牙,理顺拥堵的交通。
+
+
+
+## 领域
+
+`安德鲁`的异常体在路霸传感器塔周围的交叉路口,以及任何运行着路霸应用的智能手机十英尺范围内施加其影响
+
+
+
+
+
+## 外观
+
+路霸传感器塔外观为一个巨大的、珍珠白色的雪 茄形塔,顶部有一个绽放的蘑菇状顶盖。其顶盖 为纯黑色,覆盖着闪亮的塑料,给人一种巨型安 保摄像头的印象。无数电缆和电线将其连接到交 叉路口周围的一系列信号中继器和支撑梁上。 塔内是异常体的真实形态:安德鲁·韦恩,悬浮 在液体中,其下半身处于异常转变的晚期阶段。 血肉丝带正在分裂,化为石头,并弯曲着与自身 相连———他的整个下半身正在变成一团盘结的 道路和闪烁的交通灯
+
+如果异常体完全占据了安德鲁的人格,它将重塑 他的血肉,呈现为一个由石头和三色光构成的优 雅形象,介于天使与石像鬼之间。它有着安德鲁 的脸,但长着猪的鼻子和獠牙。
+
+
+
+## 冲动
+
+由于交通已成为紧急状况,异常体“让交通消 失”的方法变得简单粗暴:它将任何它认为麻烦 的通勤者送入循环域——悬浮在城市上空数百米 的私人空间。任务开始时,路霸将任何试图进入市中心车流的新旅客都视为麻烦。
+
+
+
+
+
+## 当前状况
+
+路霸系统启用的头两天堪称一场灾难:市中心交 通完全瘫痪。今天,几位重要人物在前往宣布路 霸系统成功的新闻发布会途中失踪。警方已切断 了进入整个市中心商业区的新车流,这使得司机 们转而使用小路,交通状况因此更加恶化。司机 们成群结队地弃车而去,选择步行或乘坐地铁穿 城而过。 而且,尽管凡俗之人无法看见,但悬浮在城市上 空的循环域数量正在稳步增长,数十个漂浮的石 球在天空中留下斑斑点点。
+
+
+
+
+
+## 晨会
+
+ 一名特工的智能手机接到一个电话,但直到 下载了该市强制要求的路霸应用后才能接 听。
+
+X 特工们注意到城市上空悬浮着一些奇怪的形状,但他们的凡俗关系人却看不到。
+
+X 一名罢工纠察线上的工人,正在用智能手机 自拍时突然消失。
+
+X 一位困惑的通勤者打断了一名特工的晨间日常,因为路霸应用指示她在上班途中穿过特工的家
+
+
+
+
+
+## 可选任务
+
++3 嘉奖:每当你从米洛斯工业夺走任何东西时时。
+
+ +1 嘉奖,每当你加固城市基础设施
+
++1 申诫,每当你坠落超过10英尺时
+
+
+
+
+
+## 任务简报
+
+在市中心及胜利环岛周边,已侦测到异常活动急剧增加。该街区也正处于持续交通危机的中 心,而随着机构的经济竞争对手——米洛斯工业——安装了基于应用的路霸交通管理系统,情 况已急剧恶化。机构还获悉,三联城天际线上方漂浮着巨大的神秘球体。 机构怀疑,要么是司机们的集体挫败感,要么是围绕米洛斯新应用的华丽营销活动,已累积了 足够的关注度从而创造出了一个异常体,并且这个异常体正是造成交通拥堵和这些巨大漂浮球 体的罪魁祸首。 特工们必须查明异常活动的来源和这些球体的性质,同时阻止恐慌在城市中进一步蔓延。灾难 响应小组正聚集在胜利环岛外,交通部即将在此召开新闻发布会。机构建议特工们从那里开始 调查。 为协助捕获该异常体,机构还为特工们提供了一份免费的特殊申领物:高速公路,任务完成后 须归还
+
+
+
+## 循环域与混沌
+
+每当特工进入一个循环域时,混沌池中就会增加 十点混沌,这些混沌只能在该循环域内使用。
+
+
+
+
+
+# 商业区
+
+## 警方路障
+
+三频道新闻的记者***`唐娜`***正向紧张的警察和愤怒的通勤者连 珠炮般地提问。她独自工作,用一台面部追踪无人机拍摄自己
+
+
+
+### 特工们可以通过回答唐娜的几个问题了解 到以下信息:
+
+州长的整个车队都消失了,包括州长***`戴安娜`***和副州长***`亚伦`***,这可能导致一场继任危机。
+
+自交通噩梦开始以来,米洛斯首席执行官 ***`埃里克***·莫纳汉`就再也没有露面。有传言 称,在路霸灾难性的发布后,他已经躲了起来。
+
+
+
+## 新闻发布会
+
+这场原为州长庆祝路霸系统成功而举办的新闻发 布会,现在成了一个灾难响应区。当特工们抵达 时,还没有人走上讲台;***三联城市长***里***`史密斯`*** 和***米洛斯公关副总裁***`莫 妮卡` 正在后台争论该向媒 体发布何种说辞: 史密斯市长认为,是时候宣布进入紧急状态,并立即暂停路霸项目,必要时强制卸载。
+
+莫妮卡不知道路霸及其内部异常体的真实性质, 但她明白,任何意外的干扰———尤其是军事响 应———都可能激怒路霸并产生意想不到的后 果。她主张给米洛斯的团队更多时间来找出解决 问题的办法
+
+
+
+## 后台
+
+`埃里克·莫纳汉`的行政助理`卡梅伦`· 也在后台。他一手拿着一个米洛斯专有平板电脑,另一只手在笔记本电脑上打字。 卡梅伦非常看重米洛斯与机构之间的竞争关系, 对任何与三角机构有关的人都抱有公开的敌意。 如果他得知特工们的真实身份,他会打断任何对 话,指示附近的米洛斯安保人员将特工们护送得 越远越好。
+
+
+
+### 特工们可以通过偷走卡梅伦的设备或使用 异常手段了解到以下信息:
+
+- `米洛斯`,或者至少是`卡梅伦`,知道异常体 的存在–——平板电脑上显示着一个交叉路口的摄像头画面,该画面模拟了“生长” 系能力“眼睛”的异常体追踪效果。
+- 通过这个视角,特工们可以看到路霸内部 安德鲁的轮廓,他的身体已经处于变形中期。
+- 米洛斯曾试图用一个凡俗的“紧急关闭开 关”来中和路霸,但没有成功———他们 确信该异常体曾是一个活物,但现在已不 再是了。
+- 一个被派去“手动禁用”路霸的质量控制小组已经失踪。
+
+
+
+## 胜利环岛
+
+溜过警方警戒线的特工可以步行接近胜利环岛的 中心交叉口。当他们穿过商业区,经由狭窄且交 叉路口频繁的街道前往胜利环岛时,会发现该市 已拆除了所有的交通信号灯和标志,代之以路霸的传感器塔和信号中继器。
+
+
+
+如果任何特工在进入胜利环岛本体时手机上安装 了路霸应用,他们以及任何同行者都会被异常体 传送进一个循环域。
+
+如果没有特工安装该应用,或把智能手机留下 了,异常体就会等到他们靠近一辆车里有安装该 应用的人时,将他们和那辆车一起传送走。 否则,如果特工们物理上足够靠近,能被异常体 侦测到其存在,它就会立即将他们送入一个循环 域。
+
+
+
+
+
+## 市长的循环域
+
+州长阿尔瓦雷斯的循环域呈现为一艘外观朴素的船屋(名为“海上核心小组”)及其周围位于三联城 富人区阿什福德的码头。无论是通过“高速公路”还是被“路霸”传送,特工们都会抵达这个循环域 中停泊船只的码头尽头
+
+
+
+码头 这个私人码头是三联城一些最富有、最有权势的 居民的停泊处。当特工们抵达时,唯一能看到的 人是州长的三名随行人员,他们正站着争吵。
+
+- `布拉德·克雷默`中尉(他/他的)已前往最近的 警察分局请求支援,并查明他们的无线电为何失 灵。几分钟后,他会气喘吁吁地回来,因为他在 几个街区外偶然撞见了循环域的边缘。如果让他 汇报情况,他会将整个团队变成散逸端。
+- 新闻秘书`米奇·罗兹`(他/他的)不希望这次访 问留下任何记录。他正试图让同伴们保持安静和 谨慎,但并未成功。
+- 副州长`亚伦·李`(他/他的)想要哗变,架空州 长,并直接干预交通问题。他坚信是米洛斯首席 执行官埃里克·莫纳汉故意制造了交通拥堵,并 打算找到他并威胁他,以制止此事。
+- ``凯伦·梅森``警官(她/他们的)阻止李副州长登 船。她希望所有人都留在原地,直到布拉德·克 雷默中尉带着更多信息和支援回来。
+
+
+
+1. 如果特工们询问州长的下落,米奇会站出来 回避问题,并告知特工们州长的日程表可以在网 上查到(实际上查不到)
+2. 如果特工们能说服随行人员,让他们相信自己有 事要找阿尔瓦雷斯州长,米奇会按响码头上的门 铃,戴安娜会在船的甲板上接待特工们。如果她 觉得他们值得一谈,就会邀请他们进去。
+
+
+
+## 海上核心小组
+
+州长船只低调的外观掩盖了其奢华而精心制作的 内饰。巨大的有色玻璃窗提供了环绕式的水景, 而船尾附近的一座硬木吧台与一排别致、看起来 很舒适的椅子相对而立。
+
+如果特工们不请自入,她正对着电话大喊:
+
+ “安全词为什么没用?安德鲁·布伦特!安德鲁· 布伦特!安德鲁·布伦特!没用!”
+
+ 在激动之下,她记错了安德鲁·韦恩的名字。当 以“安德鲁·布伦特”为目标时,“高速公路” 毫无反应。电话那头其实并没有人,但如果特工 们检查,可以发现她当时正试图联系`英迪拉·罗 伊`。
+
+
+
+## 埃里克·莫纳汉
+
+埃里克的循环域呈现为他在三联城市中心胜利广场一号米洛斯总部的顶层办公室。高速公路会将特工 们直接送到他私人办公室外的等候室
+
+
+
+### 等候室
+
+
+
+
+
+# 角色卡
+
+> 塞斯和艾拉
+
+目录
+
+海王
+
+实习生
+
+>李斯·孙卿
+
+目录
+
+顶梁柱
+
+前台
+
+> 里昂.威廉姆斯
+
+汲取
+
+海王
+
+CEO
+
+> 大卫戴
+
+低语
+
+异类
+
+PR
\ No newline at end of file
diff --git a/山东理工大学/408/离散数学.md b/山东理工大学/408/离散数学.md
new file mode 100644
index 0000000..e934945
--- /dev/null
+++ b/山东理工大学/408/离散数学.md
@@ -0,0 +1,67 @@
+# SDUT-离散数学-2024-计科2306(恩师王举辉)
+
+此计不成,既有后来人。
+
+欢迎sduter来进行讨论与指正。
+
+# 感悟
+
+这门课程就是为了后面的数据结构后学习的 主要还是以定义以及性质定理为主, 就是上课好好听(bushi)然后刚开始听可能不懂,但是后来回过头看一看 欸 突然开窍了。嘿嘿嘿。
+
+题目不是很难 但是就是定义以及性质的运用
+
+# 章一
+
+
+
+
+
+# 章二:谓词逻辑&章三:集合与关系
+
+
+
+
+
+
+
+
+
+
+
+# 章四:函数
+
+
+
+章五:代数系统
+
+
+
+
+
+
+
+
+
+
+
+# 最后一章:图论
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/山东理工大学/408/计网.md b/山东理工大学/408/计网.md
new file mode 100644
index 0000000..b65f0c6
--- /dev/null
+++ b/山东理工大学/408/计网.md
@@ -0,0 +1,138 @@
+# 范围
+
+# 计算机网络各章节复习重点
+
+## 第1章:计算机网络基础
+
+- **交换方式**
+ - 电路交换、报文交换、分组交换的特点及适用场景。
+- **网络分类**
+ - 分类标准(如覆盖范围、拓扑结构等)。
+- **体系结构**
+ - **OSI七层模型**(理论模型)与 **TCP/IP四层模型**(实际应用)的层次划分及各层作用。
+ - 五层模型(简化理解)的层次:物理层、数据链路层、网络层、运输层、应用层。
+
+---
+
+## 第2章:物理层
+
+- **关键概念**
+ - 信道极限容量(奈奎斯特定理、香农公式)的含义及计算。
+ - 码元、比特的区别;通过码元携带更多信息提高传输速率的方法。
+- **复用技术**
+ - 频分复用(FDM)、时分复用(TDM)、统计时分复用(STDM)、波分复用(WDM)的工作原理。
+ - 课后练习题:涉及数据发送方、码元与比特的计算。
+
+---
+
+## 第3章:数据链路层
+
+- **基本概念**
+ - 链路、数据链路的定义;三个基本问题(封装成帧、透明传输、差错检测)。
+ - CRC校验码的计算(需掌握课后习题)。
+- **设备与协议**
+ - 适配器(网卡)的功能。
+ - CSMA/CD协议的工作原理(以太网介质访问控制)。
+ - 集线器(物理层)与交换机(数据链路层)的区别;交换机的自学习机制及转发表建立过程。
+- **VLAN**
+ - VLAN的类型(如基于端口、MAC地址等)???及优点(隔离广播域、提高安全性等)。
+
+---
+
+## 第4-5章:网络层
+
+- **IP地址与子网划分**
+ - 分类IP地址(A/B/C/D/E类)的判断;无分类编址(CIDR)与子网掩码的作用。
+ - 子网划分(固定长度子网、可变长子网VLSM):子网号、地址范围、可用地址的计算(需结合子网掩码)。
+- **路由选择**
+ - 路由器转发分组的算法:目的IP与子网掩码按位与运算得到网络号,匹配转发表(优先顺序:主机路由 → 网络路由 → 默认路由)。
+ - 路由协议分类:
+ - 自治系统(AS)内部:RIP、OSPF等。
+ - 自治系统间:BGP。
+- **特殊地址与技术**
+ - 专用地址(私有地址)的范围及特点(互联网路由器不转发)。
+ - 虚拟专用网(VPN)与网络地址转换(NAT)的应用场景及区别。
+
+---
+
+## 第6章:运输层
+
+- **协议对比**
+ - TCP与UDP的特点及区别(连接性、可靠性、传输单位等)。
+ - 端口号的作用:区分不同应用进程。
+- **TCP核心机制**
+ - 滑动窗口机制:发送窗口大小由接收窗口和拥塞窗口共同决定。
+ - 流量控制与拥塞控制的实现:调整窗口大小;拥塞控制算法(慢开始、拥塞避免、快重传、快恢复)。
+ - 三次握手建立连接、四次挥手释放连接的过程及原因。
+- **UDP特点**
+ - 无连接、不可靠、面向报文,适用于实时数据传输(如视频流)。
+
+---
+
+## 第7章:应用层
+
+- **域名系统(DNS)**
+ - 四类服务器(根域名服务器、顶级域名服务器、权限域名服务器、本地域名服务器)的作用及域名解析过程。
+- **万维网(WWW)**
+ - 解决的四个核心问题及对应技术(HTTP协议、URL、HTML等)。
+- **常见应用协议**
+ - 区分使用TCP(如HTTP、FTP)和UDP(如DNS、DHCP)的高层协议。
+
+---
+
+## 第8章:网络安全
+
+- **安全威胁**
+ - 被动攻击(窃听、截获)与主动攻击(篡改、伪造)的区别。
+- **加密技术**
+ - 对称加密(如DES)与非对称加密(如RSA)的模型及应用场景。
+- **数字签名与保密**
+ - 数字签名的作用(鉴别发送者);结合加密实现保密的方法(如用接收方公钥加密)。
+- **安全设备**
+ - 防火墙的功能;入侵检测系统(IDS)的作用。
+
+---
+
+## 其他重点
+
+- **实验与作业**
+ - 实验报告需手写并扫描上传;重视课后习题(子网划分、CRC计算、路由转发算法)。
+ - 平时成绩构成:作业、实验、课堂表现。
+- **复习建议**
+ - 重点掌握PPT内容及教材指定章节(如分组转发算法见143页,TCP/UDP特点见216/219页)。
+
+
+
+# 物理层
+
+# 数据链路层
+
+## CSMA/CD
+
+
+
+ ANS:B
+
+
+
+
+
+
+
+
+
+
+
+
+
+## 交换机的自学习功能
+
+
+
+
+
+# 网络层
+
+
+
+
\ No newline at end of file
diff --git a/山东理工大学/image-20251118123812065.png b/山东理工大学/image-20251118123812065.png
new file mode 100644
index 0000000..b155d6d
Binary files /dev/null and b/山东理工大学/image-20251118123812065.png differ
diff --git a/山东理工大学/其他/lab3.md b/山东理工大学/其他/lab3.md
new file mode 100644
index 0000000..8e1f609
--- /dev/null
+++ b/山东理工大学/其他/lab3.md
@@ -0,0 +1,259 @@
+```sql
+-- 增删改
+INSERT INTO products (maker, model, type)
+VALUES ('I', '3008', 'printer');
+INSERT INTO sales (customer_id, model, quantity, day, paid, type_of_payment)
+VALUES ('1112223333', '3008', 2, '2024-01-01', 200, 'cash');
+INSERT INTO customers (customer_id, firstname, lastname, city, address, email)
+VALUES ('1112223333', 'Lisa', 'Smith', 'Dublin', '5 Main St.', 'lisa@example.com');
+
+-- 更新
+UPDATE pcs
+SET price = 2200
+WHERE model = '1001';
+
+
+UPDATE sales
+SET type_of_payment = 'visa credit'
+WHERE customer_id = '1122334455' AND model = '2010';
+
+UPDATE customers
+SET email = 'norah.jones@yahoo.com'
+WHERE customer_id = '9999999999';
+
+-- 删除
+DELETE FROM printers
+WHERE model = '3006';
+
+
+DELETE FROM sales
+WHERE day = '2013-12-17';
+
+DELETE FROM customers
+WHERE customer_id = '1231231231';
+
+
+
+
+-- 完成数据库新用户创建、
+CREATE USER `zds`
+-- 授权访问数据库、
+GRANT SELECT, UPDATE, INSERT ON TABLE sales TO zds;
+
+-- 授权用户传递权限(with grant option)
+GRANT SELECT ON sdut.sales TO zds WITH GRANT OPTION
+-- 收回用户的sales表更新权限
+REVOKE UPDATE ON sdut.sales FROM zds;
+
+-- 收回所有权限(彻底回收)
+REVOKE ALL PRIVILEGES ON sdut.sales FROM zds
+-- 删除创建的用户
+DROP USER zds;
+
+
+
+
+
+-- 触发器
+-- 1
+CREATE TABLE pcprice_log (
+ log_id INT AUTO_INCREMENT PRIMARY KEY,
+ model VARCHAR(10) NOT NULL,
+ old_price DECIMAL(10,2) NOT NULL,
+ new_price DECIMAL(10,2) NOT NULL
+);
+
+
+CREATE TRIGGER insert_pcpricelog_values_when_pc_price_changed
+AFTER UPDATE ON pcs
+FOR EACH ROW
+BEGIN
+ IF OLD.price != NEW.price THEN
+ INSERT INTO pcprice_log (model, old_price, new_price)
+ VALUES (OLD.model, OLD.price, NEW.price);
+ END IF;
+END;
+
+-- 测试
+-- INSERT INTO pcs (model, price, speed, ram, hd )
+-- VALUES ('1005', 200, 3.0, 8, 512);
+-- UPDATE pcs set price=22 WHERE model=1005
+
+
+-- 2定义AFTER行级触发器,当删除顾客表Customer中的一个顾客信息后,同时删除购买信息表Sales中该顾客的所有购买记录
+
+CREATE TRIGGER deleteCustomer
+after DELETE on customers
+for each row
+BEGIN
+ DELETE FROM sales
+ WHERE customer_id = OLD.customer_id;
+END
+
+-- -- 测试
+-- DELETE FROM customers WHERE customer_id=9999999999
+
+-- 3需要对在表上进行DML操作的用户进行安全检查,看是否具有合适的特权
+-- 权限表:存储用户可执行的DML权限(JSON数组格式,如["insert","update"])
+CREATE TABLE IF NOT EXISTS userPrivilege (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ user_name VARCHAR(100) NOT NULL UNIQUE COMMENT '用户名(格式:user@host,如root@localhost,匹配CURRENT_USER())',
+ privilege JSON NOT NULL COMMENT '权限列表,JSON数组,值为"insert"/"update"/"delete"(统一小写)',
+ create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '权限创建时间'
+);
+
+-- 插入测试数据:给用户zds@localhost分配INSERT/UPDATE权限,不给DELETE权限
+INSERT INTO userPrivilege (user_name, privilege)
+VALUES ('zds@localhost', '["insert", "update"]');
+-- 权限表:存储用户可执行的DML权限(JSON数组格式,如["insert","update"])
+CREATE TABLE IF NOT EXISTS userPrivilege (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ user_name VARCHAR(100) NOT NULL UNIQUE COMMENT '用户名(格式:user@host,如root@localhost,匹配CURRENT_USER())',
+ privilege JSON NOT NULL COMMENT '权限列表,JSON数组,值为"insert"/"update"/"delete"(统一小写)',
+ create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '权限创建时间'
+);
+
+-- 插入测试数据:给用户zds@localhost分配INSERT/UPDATE权限,不给DELETE权限
+INSERT INTO userPrivilege (user_name, privilege)
+VALUES ('zds@localhost', '["insert", "update"]');
+
+DELIMITER //
+CREATE TRIGGER trg_check_update_priv
+BEFORE UPDATE ON customers -- 同样可替换为目标表
+FOR EACH ROW
+BEGIN
+ DECLARE user_priv JSON;
+ DECLARE has_update INT DEFAULT 0;
+ DECLARE curr_user VARCHAR(100) DEFAULT CURRENT_USER();
+
+ -- 查询当前用户权限
+ SELECT privilege INTO user_priv
+ FROM userPrivilege
+ WHERE user_name = curr_user;
+
+ -- 判断是否有"update"权限
+ IF user_priv IS NOT NULL THEN
+ SET has_update = JSON_CONTAINS(user_priv, '"update"');
+ END IF;
+
+ -- 无权限抛错
+ IF has_update = 0 THEN
+ SIGNAL SQLSTATE '45000'
+ SET MESSAGE_TEXT = CONCAT('安全检查失败:用户 [', curr_user, '] 无 ', TABLE_NAME, ' 表的 UPDATE 权限');
+ END IF;
+END //
+DELIMITER ;
+DELIMITER //
+CREATE TRIGGER trg_check_delete_priv
+BEFORE DELETE ON customers -- 同样可替换为目标表
+FOR EACH ROW
+BEGIN
+ DECLARE user_priv JSON;
+ DECLARE has_delete INT DEFAULT 0;
+ DECLARE curr_user VARCHAR(100) DEFAULT CURRENT_USER();
+
+ -- 查询当前用户权限
+ SELECT privilege INTO user_priv
+ FROM userPrivilege
+ WHERE user_name = curr_user;
+
+ -- 判断是否有"delete"权限
+ IF user_priv IS NOT NULL THEN
+ SET has_delete = JSON_CONTAINS(user_priv, '"delete"');
+ END IF;
+
+ -- 无权限抛错
+ IF has_delete = 0 THEN
+ SIGNAL SQLSTATE '45000'
+ SET MESSAGE_TEXT = CONCAT('安全检查失败:用户 [', curr_user, '] 无 ', TABLE_NAME, ' 表的 DELETE 权限');
+ END IF;
+END //
+DELIMITER ;
+
+-- 4如果某个特定客户ID的购买记录从销售表中删除后,则从客户表中删除该客户。
+CREATE TRIGGER deleteCustomer_by4
+AFTER DELETE on sales
+for each row
+BEGIN
+ DELETE FROM customers
+ WHERE customer_id = OLD.customer_id;
+END
+
+CREATE TRIGGER discount AFTER INSERT ON sales FOR EACH ROW
+BEGIN
+ DECLARE
+ sum_paid DECIMAL ( 12, 2 );
+ DECLARE
+ discount DECIMAL ( 5, 2 );
+ SELECT
+ sum( paid ) INTO sum_paid
+ FROM
+ sales
+ WHERE
+ customer_id = NEW.customer_id;
+ SELECT
+ discount INTO discount
+ FROM
+ customers
+ WHERE
+ customer_id = NEW.customer_id;
+ IF
+ SUM_paid > 10000
+ AND discount < 10.00 THEN
+ UPDATE customers
+ SET discount = 10.00
+ WHERE
+ customer_id = NEW.customer_id;
+
+ END IF;
+
+ END
+
+
+-- 6在客户中添加一个新的"AllPaid"栏,如果插入或更新或删除一个销售元组,那么修改该客户的"AllPaid"的值
+
+ALTER TABLE customers
+ADD COLUMN AllPaid DECIMAL(12,2) NOT NULL DEFAULT 0.00
+
+CREATE TRIGGER insert_value_customer
+AFTER INSERT on customers
+for each ROW
+BEGIN
+ UPDATE customers
+ set AllPaid =(
+ SELECT SUM(paid) FROM sales
+ WHERE customer_id = NEW.customer_id
+ )
+ WHERE customer_id = NEW.customer_id;
+ END
+
+
+ CREATE TRIGGER UPDATE_value_customer
+AFTER UPDATE on customers
+for each ROW
+BEGIN
+ UPDATE customers
+ set AllPaid =(
+ SELECT SUM(paid) FROM sales
+ WHERE customer_id = NEW.customer_id
+ )
+ WHERE customer_id = NEW.customer_id;
+ END
+
+
+ CREATE TRIGGER DELETE_value_customer
+AFTER DELETE on customers
+for each ROW
+BEGIN
+ UPDATE customers
+ set AllPaid =(
+ SELECT SUM(paid) FROM sales
+ WHERE customer_id = old.customer_id
+ )
+ WHERE customer_id = old.customer_id;
+ END
+-- 测试
+
+
+```
+
diff --git a/山东理工大学/其他/lab4.md b/山东理工大学/其他/lab4.md
new file mode 100644
index 0000000..6aa8673
--- /dev/null
+++ b/山东理工大学/其他/lab4.md
@@ -0,0 +1,96 @@
+CREATE PROCEDURE RateModel ( IN cid VARCHAR ( 20 ), IN m VARCHAR ( 20 ), IN r INT ) BEGIN-- 1. 插入新评分记录
+ INSERT INTO ratings ( customer_id, model, rating_time, rating )
+ VALUES
+ ( cid, m, NOW( ), r ) -- 2. 更新 Products 表的总评分和评分次数
+ INSERT IGNORE INTO Products ( total_rating, number_of_ratings )
+ VALUES
+ ( 0, 0 );-- 3. 计算该型号的最新总评分和评分次数
+ UPDATE products
+ SET total_rating = ( SELECT COALESCE( SUM( rating ), 0 ) FROM Ratings WHERE model = m ),
+ number_of_ratings = ( SELECT COUNT( * ) FROM Ratings WHERE model = m )
+ WHERE
+ model = m;
+
+ END --
+-- 2
+ CREATE PROCEDURE DeleteRating ( IN cid ( 10 ), IN m ( 10 ), ) BEGIN
+ CALL RateModel ( p_customer_id, p_model, NULL );
+
+ END -- 3
+ CREATE PROCEDURE CleanRatings ( INT cid ( 10 ) INT m ( 10 ) ) BEGIN
+ DELETE
+ FROM
+ Rating
+ WHERE
+ customer_id = cid
+ AND model = m
+ AND rating_time < (
+ SELECT
+ max_time
+ FROM
+ ( SELECT MAX( r2.rating_time ) AS max_time FROM Ratings AS r2 WHERE r2.customer_id = p_customer_id AND r2.model = p_model ) AS t
+ );
+
+ END;
+ CALL RateModel ( '1122334455', '1001', 3 );
+ CALL RateModel ( '1122334455', '1001', 2 );
+ CALL RateModel ( '9999999999', '1001', 5 );
+ CALL RateModel ( '1122334455', '1001', NULL );
+ CALL RateModel ( '9999999999', '1001', 4 );
+ CALL RateModel ( '9999999999', '1001', NULL );
+ CALL RateModel ( '1122334455', '1001', 2 );
+ CALL CleanRatings ( '9999999999', '1001' );
+ CALL CleanRatings ( '1122334455', '1001' );
+
+
+
+
+-- 3
+CREATE VIEW AverageRatings(model, average_rating)
+AS
+SELECT
+ model,
+ COALESCE(SUM(rating) / COUNT(*), 0) AS average_rating
+FROM Ratings
+GROUP BY model
+HAVING COUNT(*) > 0; -- 仅包含至少有1次评分的型号
+
+
+-- 3.b
+DELIMITER //
+CREATE FUNCTION BestModel()
+RETURNS VARCHAR(20)
+DETERMINISTIC
+BEGIN
+ DECLARE max_avg FLOAT;
+ DECLARE best_model VARCHAR(20);
+
+ -- 步骤1:获取最高平均评分
+ SELECT MAX(average_rating) INTO max_avg FROM AverageRatings;
+
+ -- 步骤2:若无评分,返回NULL
+ IF max_avg IS NULL THEN
+ RETURN NULL;
+ END IF;
+
+ -- 步骤3:获取平均评分最高的所有型号,选择最新非空评分的型号
+ SELECT model INTO best_model
+ FROM (
+ -- 子查询:获取平均评分最高的型号,及其最新非空评分时间
+ SELECT
+ ar.model,
+ MAX(CASE WHEN r.rating IS NOT NULL THEN r.rating_time ELSE NULL END) AS latest_non_null_time
+ FROM AverageRatings ar
+ JOIN Ratings r ON ar.model = r.model
+ WHERE ar.average_rating = max_avg
+ GROUP BY ar.model
+ ORDER BY latest_non_null_time DESC -- 按最新非空评分时间降序
+ LIMIT 1 -- 取最新的一个
+ ) AS temp;
+
+ RETURN best_model;
+END //
+DELIMITER ;
+
+
+-- 3.c
\ No newline at end of file
diff --git a/山东理工大学/其他/事件驱动.md b/山东理工大学/其他/事件驱动.md
new file mode 100644
index 0000000..0932754
--- /dev/null
+++ b/山东理工大学/其他/事件驱动.md
@@ -0,0 +1,592 @@
+# C++ Key Topics Summary for Final Review (C++ 知识点期末复习总结
+
+## Lecture 1: Introduction to C++ (第1讲:C++简介)
+
+**Key Concepts 主要知识点:**
+
+- **Machine Language(机器语言)** – The most basic programming language, consisting of binary code (0和1) directly executed by hardware. Machine code is **machine-dependent(与硬件相关)**; a program written for one type of CPU won’t run on another.
+- **Assembly Language(汇编语言)** – Uses short English-like **mnemonics(助记符)** to represent machine instructions. Requires an **assembler(汇编器)** to translate into machine code. Assembly is easier to read than binary but still specific to a CPU architecture.
+- **High-Level Language(高级语言)** – A programming language with English-like syntax and math-like notation. Examples: C++, Java. High-level code is portable and must be converted to machine code by a **compiler(编译器)** or run by an **interpreter(解释器)**. C++ is compiled into machine code (可编译成机器码执行), whereas Java is compiled to bytecode and run on the Java Virtual Machine (运行于JVM).
+- **Phases of C++ Program Compilation(C++程序的编译阶段)** – C++ code undergoes several steps: **preprocessing(预处理)**, **compiling(编译)**, **linking(连接)**, and **loading(载入)**. The **preprocessor(预处理程序)** handles directives (like `#include`) before compilation. The **compiler(编译器)** translates source code to object code (machine instructions). The **linker(连接器)** combines your object code with libraries to produce an executable. The **loader(加载程序)** then loads the executable into memory for execution.
+- **Object-Oriented Programming (OOP, 面向对象编程)** – C++ supports OOP, which involves organizing software as collections of **classes(类)** and **objects(对象)**. It emphasizes concepts like **encapsulation(封装)**, **inheritance(继承)**, and **polymorphism(多态)**. (Java is also OOP; C++ and Java share OOP concepts, but C++ allows lower-level memory control.)
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 本章讨论的三种语言类型是 ***\**\*、\*\**\*** 和 ______。【提示】机器语言(machine language)、汇编语言(assembly language)和高级语言(high-level language)。
+2. **填空题:** 在C++系统中,______ 程序在编译器开始翻译之前执行。【提示】预处理程序(preprocessor)。
+3. **填空题:** ______ 程序将编译器的输出与各种库函数结合起来生成可执行程序。【提示】连接器(linker)。
+4. **填空题:** ______ 程序将可执行程序从磁盘传送到内存中准备运行。【提示】加载程序(loader)。
+
+*Answers 答案:* 1) 机器语言, 汇编语言, 高级语言; 2) **预处理**程序; 3) **连接**程序; 4) **加载**程序。每个阶段各司其职,共同完成从源代码到可执行代码的转换。
+
+## Lecture 2: Basic Syntax and Printing (第2讲:C++基本语法与打印)
+
+**Key Concepts 主要知识点:**
+
+- **Comments(注释)** – Non-executing text used to document code. `//` begins a **single-line comment(单行注释)**, and `/* ... */` encloses a **multi-line comment(多行注释)**. Comments improve readability and are ignored by the compiler (编译时会被忽略). (Java uses the same comment styles.)
+- **Preprocessor Directive(预处理指令)** – Lines beginning with `#` (like `#include `) are processed by the preprocessor **before** compilation. For example, `#include ` inserts the declarations for input/output streams (输入输出流库) so we can use `std::cout` and `std::cin`. In C++, `` is analogous to Java’s `java.io` package, but C++ uses include files instead of import statements.
+- **`main` Function(主函数)** – The entry point of a C++ program. Defined as `int main()` typically. The keyword **`int`** indicates main returns an integer status code to the system. In C++, `main` can be outside any class (不属于任何类), whereas in Java the entry point is a `public static void main` method within a class.
+- **Statements and Semicolon(语句和分号)** – A **statement(语句)** is an instruction terminated by a semicolon `;`. C++ is a free-form language: you can use **whitespace(空白字符)** (spaces, tabs, newlines) to format code for readability; extra whitespace is generally ignored by the compiler. Each statement must end with `;`
+- **Output with `std::cout`(使用cout输出)** – Use `std::cout << "text";` to print to the console. The `<<` is the **stream insertion operator(流插入运算符)**, sending data to the output stream.
+- **Input with `std::cin`(使用cin输入)** – `std::cin` is the standard input stream (对应键盘输入). Using the extraction operator `>>`, as in `std::cin >> x;`, reads input into variable `x`. (Similar to Java’s `Scanner`, but C++ I/O is type-safe and reads whitespace-delimited tokens by default.)
+- **Variables and Memory(变量与内存)** – A variable in C++ has a **name (identifier, 标识符)**, a **type(类型)**, and stores a value in memory. All variables **must be declared before use(先声明后使用)**. Common primitive types: `int` 整型, `double` 双精度浮点, `char` 字符型, `bool` 布尔型 (布尔值用`true`/`false`). C++ types correspond to Java’s primitive types, but note that boolean values in C++ can be implicitly converted to integers (true为1, false为0), whereas Java strictly separates `boolean` from numeric types.
+- **Operators and Expressions(运算符与表达式)** – C++ supports arithmetic operators (`+ - * / %`), assignment operators (`=` and compound assignments like `+=`), and **relational operators(关系运算符)** (`== != < > <= >=`) for comparisons. Also logical operators (`&& || !`) for boolean logic. These work similarly to Java. One difference: In C++ you can use an `int` or other numeric in a condition (非零即真, 0为假), but in Java the condition of an `if` or loop must strictly be a boolean expression.
+- **`if` Statement(条件语句)** – Allows decision-making. **`if`** executes a block if a condition is true. **`if...else`** chooses one block if condition true, otherwise the else-block (如果条件为假则执行else部分). In C++, as in Java, conditions use `==` for equality (注意避免将`=`误用在条件判断中). C++99 introduced a **bool** type, so modern C++ uses `true/false` similarly to Java, but older C style (如使用0和1表示真假) is still valid.
+- **`return` Statement(返回语句)** – Ends a function and returns a value. In `main`, `return 0;` typically indicates successful execution. If omitted in C++ `main`, it defaults to 0. (Java’s `main` is `void`, so it doesn’t return a value to the system.)
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 每个C++程序的执行从函数 ______ 开始。【提示】C++程序从`main`函数开始执行。
+2. **填空题:** 大多数C++语句以 ______ 结束。【提示】C++语句以分号(`;`)结束。
+3. **判断题:** 转义序列`\n`通过cout输出时会将光标移动到下一行开头。(对/错)【提示】`\n`表示换行,输出它会换行,**因此表述正确**。
+4. **判断题:** 所有变量在使用之前都必须先声明。(对/错)【提示】C++要求变量先声明再使用,**该说法正确**。
+
+*Suggested Answers 答案:* 1) **main**; 2) **分号** (即每条语句末尾加`;`); 3) 对。`\n`是换行符,会使输出换到新行; 4) 对。在C++中必须先定义变量类型和名称,然后才能赋值或使用它。请注意区分赋值运算符`=`和相等比较运算符`==`,避免在条件判断中误用。
+
+## Lecture 3: Classes, Objects and Strings (第3讲:类、对象与字符串)
+
+**Key Concepts 主要知识点:**
+
+- **Class(类)** – A blueprint for creating objects (对象模版). A class defines a new **data type(数据类型)** that groups data and functions. For example, `class GradeBook { ... };` defines a `GradeBook` class. A class contains **data members(数据成员)** (also called **attributes 属性** or **fields 字段**) and **member functions(成员函数)** (also called **methods 方法**). By default, class members are **private(私有)** in C++ (only accessible by the class’s own functions). Public interface is declared after the `public:` label. *(Java类默认成员可见性不同,Java中成员缺省是包可见,而C++类缺省是private。)*
+- **Object(对象)** – An instance of a class. When you create an object, e.g., `GradeBook myGradeBook;`, it allocates memory for the data members and allows you to call member functions on it. Each object has its own copies of the class’s non-static data members (每个对象都有自己的一份数据成员). In OOP, an object’s data should usually be kept private, accessed only via the class’s public member functions (**encapsulation 封装**原则).
+- **Member Function(成员函数)** – A function defined inside a class, describing behaviors or operations on class data. For example, `displayMessage()` might print a welcome message stored in a `GradeBook` object. Member functions can be defined inside the class definition or separately (using the scope resolution operator `ClassName::functionName`). By default, member functions are not **virtual(虚拟)** unless specified (see Lecture 11 for polymorphism details). *(Java的方法默认是虚拟(可覆盖)的,但C++需要明确使用`virtual`才能实现运行时多态。)*
+- **Access Specifiers(访问说明符)** – Keywords like `public`, `private`, and `protected` that control access to class members. **`public` 公有** members are accessible from outside the class (接口API), while **`private` 私有** members are hidden from outside (只能被该类的成员函数访问). C++ class definitions often list public functions first (interface) and keep data members private. *(Java有类似的public/private修饰符,还有protected和默认访问级别; C++的protected在继承时用,后续讲解。)*
+- **CamelCase Naming(驼峰命名)** – By convention, C++ class names start with a capital letter and use capital letters to distinguish words (e.g., `GradeBook`), whereas function names typically start with lowercase (e.g., `displayMessage`). This is a stylistic convention to improve code readability (在代码中区分类名和函数名). Java uses a similar convention (类名首字母大写,方法名首字母小写).
+- **Constructors(构造函数)** – A special class member function that has the same name as the class and is used to initialize new objects (初始化对象). A **default constructor(默认构造函数)** is one that can be called with no arguments (either because it has no parameters or all parameters have default values). Constructors have no return type (not even void). In C++, if you do not define a constructor, the compiler provides a default constructor. Constructors are often used to set initial values for data members when an object is created.
+- **`string` Class(字符串类)** – C++ provides `std::string` (in `` header) to represent text strings. You can create strings like `string s = "hello";` and use `s.length()` or `s.size()` for length, `s[0]` for character access, etc. This is similar to Java’s `String` class, but C++ `std::string` is mutable (可变的) and uses value semantics (copy on assignment) unless otherwise specified. Older C-style strings use char arrays terminated by `'\0'`, but `std::string` is safer and easier. *(Java的String是不可变对象; C++的std::string可以修改内容,例如`s.append("!");`添加字符。)*
+- **Getters and Setters(访问器和修改器)** – It’s common to provide public member functions to **get** and **set** private data members. For example, a `GradeBook` class might have `getCourseName()` and `setCourseName()` to access a private `courseName` attribute. This preserves encapsulation by controlling how outside code interacts with class data. *(Java亦如此,通常用getX/setX方法访问私有字段。)*
+- **Separating Interface and Implementation(头文件与实现)** – C++ practice is to put class definitions in a header file (e.g., `GradeBook.h`) and function implementations in a `.cpp` file, then include the header where needed. This separation allows multiple source files to include the class definition without duplication. Java does not separate interface and implementation in the same way; Java class definitions (fields and method signatures and bodies) are all in one `.java` file, but C++ encourages dividing the declaration (.h) and implementation (.cpp).
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 每个类定义都以关键字 ______ 开头,后面紧跟类名。【提示】定义类以`class`开头,例如`class ClassName`。
+2. **填空题:** 类定义通常存储在文件以 ______ 扩展名结尾的文件中,以便被多处引用。【提示】头文件通常以`.h`或`.hpp`结尾。
+3. **填空题:** 当每个对象都有自己的某个属性副本时,这种属性变量也称为 ______ 。【提示】实例成员变量,即**数据成员**。
+4. **填空题:** 关键字`public`是一种 ______ 。【提示】`public`是访问说明符(access specifier)。
+5. **判断题:** 按照惯例,函数名应以大写字母开头,每个单词首字母大写。(对/错)【提示】函数名一般**不**以大写开头,而是首字母小写,所以该说法是**错**的。
+6. **判断题:** 函数定义中紧随函数名的空括号表示该函数不需要任何参数即可执行。(对/错)【提示】空参数列表表示无参数,该说法**正确**。
+7. **判断题:** 用`private`声明的数据成员或成员函数对该类的其他成员函数也是不可见的。(对/错)【提示】私有成员对本类的函数是可访问的,对类外才不可见,所以表述**错误**。实际上,private成员可以被本类的成员函数访问。
+8. **判断题:** 在某成员函数内部定义的变量称为数据成员,可以被该类的所有成员函数使用。(对/错)【提示】在函数内部定义的变量是**局部变量**,只能在该函数内部使用,不是整个类的成员,所以**错误**。
+9. **判断题:** 每个函数体都由左花括号`{`开始、右花括号`}`结束。(对/错)【提示】函数体需用`{}`包围,**正确**。
+10. **编程题:** *Invoice*(发票)类设计:创建一个名为Invoice的类以表示商店售出的某项商品的发票。这个类应包含以下私有数据成员: 商品编号(字符串), 商品描述(字符串), 购买数量(int), 单价(int)。为每个数据成员提供成对的`set`和`get`函数。此外,提供一个构造函数用于初始化所有成员,并提供一个名为`getInvoiceAmount`的成员函数来计算发票总额(即数量乘以单价)并返回该值(int)。如果购买数量或单价为负,则将其设为0再计算总额。**要求:** 翻译以上需求,并给出实现提示。
+
+## Lecture 4: Control Statements (第4讲:控制语句)
+
+**Key Concepts 主要知识点:**
+
+- **Algorithm(算法)** – A procedure or formula for solving a problem, consisting of a sequence of actions in a specific order (一系列有序执行的操作). Writing an algorithm in simple steps before coding helps in program design.
+
+- **Pseudocode(伪代码)** – An informal, English-like way to describe an algorithm’s steps. Pseudocode is not actual code; it omits syntactic details and focuses on logic. It helps to plan programs without worrying about language syntax. (书写伪代码有助于先理清思路,再将其转换为真正的C++代码。)
+
+- **Control Structures(控制结构)** – Basic constructs that dictate the flow of program execution. All programs can be built using three fundamental structures: **sequence(顺序执行)**, **selection(选择执行)**, and **iteration(循环执行)**. C++ (like Java) has corresponding **control statements(控制语句)** for each:
+
+ - **Sequence 顺序结构:** The default execution order where statements run one after another in the order written (顺序执行每条语句).
+ - **Selection 选择结构:** Making decisions. C++ provides **`if` 单分支** and **`if...else` 双分支** statements, and the **`switch` 多分支** statement for multi-way branching. The `if` statement executes a block if a condition is true; `if...else` chooses between two blocks. The `switch` statement tests an integer (or enum/char) expression and executes the case matching that value (each `case`标签后跟要执行的语句块). *Java’s `switch` is similar but can also use strings; C++17开始也允许`switch`字符型或枚举型,传统C++中`switch`不支持字符串。*
+ - **Iteration 循环结构:** Repeating actions. C++ has **`while`** and **`for`** loops (可能执行零次或多次) and a **`do...while`** loop (至少执行一次). A **`while` loop(当型循环)** repeats as long as a condition remains true (先检查条件,再执行循环体). A **`for` loop(计数循环)** is typically used for a known number of iterations, with initialization, condition, and increment in one line. A **`do...while` loop(后测试循环)** executes the body first, then checks the condition to decide if it should repeat. In all these, a loop condition works like an `if` condition: in C++ nonzero means true, zero means false. *(Java的循环与C++基本一致,也有`while`, `for`, `do...while`,但注意Java中必须使用布尔表达式作为循环条件,C++中整数也可作为条件使用。)*
+
+- **`if` and `if...else` (条件语句)** – The `if` structure allows conditional execution. Syntax:
+
+ ```cpp
+ if (condition) {
+ // true block
+ } else {
+ // false block
+ }
+ ```
+
+ If the **condition(条件)** is true (非0或`true`), the first block executes; otherwise the `else` block executes (if present). Use braces `{}` to group multiple statements in a block. *良好习惯:即使只有一条语句,也使用花括号以避免歧义(Good practice to always use braces for clarity).* You can nest ifs for multiple levels of decision (嵌套的if结构处理更复杂的条件).
+
+- **`switch` Statement(多路分支)** – Used for multi-way branching based on an integer or enum expression. Syntax:
+
+ ```cpp
+ switch (expression) {
+ case constant1:
+ // statements
+ break;
+ case constant2:
+ // statements
+ break;
+ ...
+ default:
+ // statements
+ }
+ ```
+
+ The **`case` labels(分支标签)** must be constant expressions. The `switch` transfers control to the matching case. Without an explicit `break`, execution will “fall through” to the next case (贯穿后续case). Typically, each case ends with `break` to prevent fall-through (除非有意连续执行). The `default` label handles any value not matched by cases. *(Java的switch相似,但在Java中使用字符串作为case是允许的,而传统C++不直接支持字符串。无论C++还是Java,都需要break避免贯穿。)*
+
+- **Loops(循环)** – Three types in C++:
+
+ - **`while` loop(当型循环)**: Checks condition first, then executes loop body if condition is true. Continues checking and executing until condition becomes false. Example: `while (x > 0) { x--; }`. If condition is initially false, the loop body may not execute at all.
+
+ - **`do...while` loop(至少执行一次的循环)**: Executes the loop body **at least once** and then checks the condition at the end. Syntax:
+
+ ```cpp
+ do {
+ // body
+ } while(condition);
+ ```
+
+ Useful when the loop body should run at least one time (例如菜单处理,需要先显示菜单再判断是否重复).
+
+ - **`for` loop(计数循环)**: Typically used when the number of iterations is known or to iterate over a range. Syntax:
+
+ ```cpp
+ for ( initialization; condition; increment ) {
+ // body
+ }
+ ```
+
+ Example: `for(int i=0; i<5; ++i) { ... }` will loop 5 times (i从0到4). The `for` loop is essentially a compact form of a while: initialization executes once at loop start, then each iteration checks condition and executes body, then performs increment step. C++11 adds a **range-based for loop(基于范围的for循环)**, e.g., `for(int val : array) { ... }`, to iterate over containers/arrays easily (类似Java增强for循环).
+
+- **`break` and `continue`** – Within loops (以及switch中), **`break`(跳出)** immediately exits the loop (终止当前循环), and **`continue`(继续下轮)** skips the remaining statements in the loop body and proceeds with the next iteration (提前进入下一次循环判断). Use these carefully to avoid confusing flow. *(Java中break/continue语义相同。)*
+
+- **Logical Operators(逻辑运算符)** – `&&` (AND), `||` (OR), and `!` (NOT) are used to form complex conditions (组合多个条件). They work similarly to Java, including short-circuit evaluation (短路求值): in `expr1 && expr2`, if `expr1` is false, `expr2` is not evaluated at all. Likewise for `||`: if the first operand is true, the second is skipped. Use parentheses to clarify logic when needed.
+
+- **Compound Assignment(复合赋值)** – Operators like `+=`, `-=`, `*=`, `/=`, `%=` for combining arithmetic with assignment. E.g., `x += 5;` adds 5 to x (相当于 `x = x + 5;`). These make code concise. C++ also has **increment/decrement operators(自增/自减)**: `++x` or `x++` to add 1, `--x` or `x--` to subtract 1. Prefix (`++x`) vs postfix (`x++`) matters in expressions (前置返回新值, 后置返回旧值), but as standalone statements both increment x. (Java also has these operators with the same behavior.)
+
+- **Data Type Portability(数据类型可移植性)** – An awareness point: Fundamental types like `int` may have different sizes on different platforms (e.g., 32-bit vs 64-bit systems). C++ defines minimum ranges (e.g., `int` at least ±32,767) but not exact sizes in the language standard. Java’s primitive types have fixed sizes (e.g., int is always 32-bit) making them more portable across platforms. C++11 introduced fixed-width types (如`int32_t`) in `` for precise control when needed.
+
+- **Boolean context(布尔上下文):** In C++, an `int` or pointer can be used in a boolean context (非零即真), whereas Java requires a true boolean value for conditions (在Java中使用非boolean作为条件会编译错误). For example, `while(n)` is valid in C++ (loops while n≠0), but in Java you must write `while(n != 0)`.
+- **Switch limitations(switch的限制):** C++ `switch` can use integral types (int/char/enum) but not strings or objects. Java’s `switch` (since Java 7) allows `String` and wrapper types. Also, C++ does not automatically break at the end of a case (必须手工`break`防止贯穿), same as Java. Both languages support a `default` case.
+- **Loop features:** Both anguages support `break` and `continue` inside loops. Java adds labeled breaks/continues; C++ doesn’t have labeled loop control (no equivalent to Java’s `label:` with break label).
+- **for-each loop:** Modern C++ (`range-based for`) is akin to Java’s enhanced for loop for arrays/collections. Syntax differs slightly but concept is the same (iterate through elements directly).
+- **do...while:** Present in both languages with identical behavior (loop executes at least once).
+- **No implicit type conversion to boolean in Java:** Java不会将数字自动转为布尔,这在C++中需要注意,如果将C++代码移植到Java,要显式比较==0或!=0。
+- **Precision of types:** As mentioned, Java’s types have fixed size (e.g., `int` 32-bit), whereas C++’s may vary; this can affect loop ranges or portability if you assume a certain size in C++.
+
+**After-class Exercises 课后练习:**
+
+1. **判断题:** 在`if`语句中,若条件不加括号也能正常编译运行。(对/错)【提示】条件必须放在圆括号内,漏写括号会导致语法错误,**错误**。正确格式如:`if (x > 0) {...}`。
+
+2. **判断题:** 在`switch`的每个`case`分支后都应使用`break`来防止执行落入下一个分支。(对/错)【提示】一般应加`break`避免“贯穿”行为,**正确**。如需特意贯穿,可以省略,但必须十分小心。
+
+3. **判断题:** 在`for`循环中使用`continue`语句会提前跳出整个循环。(对/错)【提示】`continue`只是跳过本次余下循环并进入下一次迭代,不会终止循环,**错误**。结束整个循环应使用`break`。
+
+4. **编程题:** **判断回文数(Palindrome)** – 定义一个函数`bool isPalindrome(string str)`,如果字符串正着读和反着读都相同则返回`true`,否则返回`false`。例如:"madamimadam"是回文。请将此函数补充完整。
+
+ **提示:** 所谓“回文”指序列从前往后和从后往前相同。解决思路:可以使用两个索引分别从字符串头部和尾部向中间移动,逐字符比较是否相等。一旦发现对应字符不相等,就可以断定不是回文。若所有字符成对匹配,则是回文。如:
+
+ ```cpp
+ bool isPalindrome(string str) {
+ int i = 0, j = str.length() - 1;
+ while(i < j) {
+ if(str[i] != str[j])
+ return false;
+ i++;
+ j--;
+ }
+ return true;
+ }
+ ```
+
+ 此函数遍历字符串的一半长度即可完成判断,时间复杂度为O(n)。在调用时可传入数字的字符串形式进行判断(也可以先将int转换为string再调用)。*(In Java, one could similarly check by comparing `str.charAt(i)` and `str.charAt(j)` in a loop.)*
+
+## Lecture 5: Functions, Recursion and Overloading (第5讲:函数、递归与重载)
+
+**Key Concepts 主要知识点:**
+
+- **Functions(函数)** – Named blocks of code that perform a specific task, improving modularity (模块化) and reuse. Functions in C++ can be **standalone (free) functions(自由函数)** or member functions of classes. A function **definition(定义)** consists of a return type, name, parameter list, and body. A **function call(调用)** executes the function’s body. For example, `int add(int a, int b) { return a+b; }` defines a function `add` that returns an int sum, and you call it as `int result = add(3,4);`. Functions allow **divide-and-conquer programming** by breaking a program into smaller pieces. *(Java的方法类似,但Java没有独立的全局函数,所有方法必须属于类;C++既有类成员函数也允许全局函数定义。)*
+- **Function Prototype(函数原型)** – A function declaration that specifies the function’s interface (name, return type, parameters) without the body. For example, `int add(int, int);` is a prototype. Prototypes (often placed in headers) allow the compiler to know about a function before its definition appears, enabling calls from code that comes lexically before the function’s definition. The compiler uses the prototype to verify calls (参数类型和数量是否匹配) and perform **type coercion(类型转换)** for arguments if needed. In C++, you **must** either declare or define a function before calling it (Java doesn’t require forward declarations because the one-pass compiler or JIT knows all class methods by design).
+- **Parameters and Arguments(形参与实参)** – **Parameters(形式参数)** are variables declared in the function definition/prototype to receive data, and **arguments(实参)** are the actual values passed to the function when called. The number, order, and types of arguments must match the function’s parameters (except where default parameters are used). C++ evaluates arguments left-to-right (evaluation order unspecified in older C++ standards, but guaranteed in C++17). By default, C+。+ uses **pass-by-value(值传递)**, meaning the function gets a copy of the arguments (函数操作形参不会影响调用者提供的实参变量). You can also use **pass-by-reference(引用传递)** or pointers to allow the function to modify caller variables (e.g., `void foo(int &x) { x = 5; }`). *(Java方法参数传递都是值传递,但对象引用作为值传递可以间接修改对象的内容。Java没有C++引用这种语法,但对象参数可改变其内部状态。)*
+- **Return Value(返回值)** – The value a function gives back after completion, specified by the function’s return type. Use the `return` statement to return a value and exit the function. If a function is declared with a non-void type, it should return a value of that type. If the function is `void`, it does not return a value (though it can use `return;` to exit early). In C++, failing to return a value from a non-void function results in undefined behavior (Java would not compile such a method).
+- **Void Functions(void函数)** – Declared with `void` return type, they do not return any value. They typically perform actions like printing or modifying global state. For example, `void printMessage() { cout<<"Hi"; }`. You call it as `printMessage();` and there’s no result to use. (Java’s `void` methods are analogous.)
+- **Local and Global Variables(局部和全局变量)** – **Local variables(局部变量)** are those defined inside a function (including parameters), which exist only during function execution and are not known outside. Each call creates new instances of local variables (stored on the **stack 栈**). **Global variables(全局变量)** are defined outside any function, accessible from any code after their declaration (unless restricted by `static` or namespaces). Global variables in C++ have program duration (allocated in static storage). It’s good practice to minimize globals for modularity.
+- **Storage Class and Lifetime(存储类与生命周期)** – C++ variables have storage durations: **automatic(自动存储期)** for locals (allocated on function entry, freed on exit), **static(静态存储期)** for globals and `static` local variables (allocated when program starts or when first encountered for local statics, freed at program end), and **dynamic(动态存储期)** for memory allocated via `new` (lives until `delete`). For example, a `static int count;` inside a function retains its value between calls (第一次调用时初始化一次,以后调用保留之前的值). Java manages object lifetimes with garbage collection and has no direct equivalent to C++ manual memory allocation in terms of keywords (no `new`/`delete` pairing visible to programmer; Java’s `new` automatically managed by GC).
+- **Math Library Functions(数学库函数)** – C++ `` header provides common functions like `sqrt()`, `pow()`, `sin()`, etc. These are global (not class members) and can be called by including `` and writing e.g. `double r = sqrt(4.0);`. (Java has similar math functions in `java.lang.Math` as static methods, e.g., `Math.sqrt(4.0)`).
+- **Function Overloading(函数重载)** – C++ allows multiple functions with the **same name** but different parameter lists (不同的参数签名) in the same scope. The compiler distinguishes them by their **signature(函数签名)** – the combination of function name and parameter types (顺序及数量). For example, you can have `int max(int,int)` and `double max(double,double)`. When you call `max(3,5)`, the int version is invoked; `max(3.5, 4.2)` calls the double version. Overloading lets you use a common name for conceptually similar operations on different types. *(Java also supports method overloading in classes. In both languages, return type alone is not enough to overload; 参数列表必须不同。)* The compiler uses **name mangling(名字改编)** under the hood to encode parameter types in the symbol name, enabling type-safe linkage.
+- **Default Arguments(默认参数)** – C++ allows you to specify default values for parameters in function declarations. For instance, `void print(int count = 1)` means if `print()` is called without an argument, `count` will default to 1. Default arguments must be the rightmost parameters, and if you omit one argument in a call, you must omit all to its right. Java does not have default parameters; instead, you overload methods to achieve similar behavior. *(注意:默认参数值在函数声明处给出,在调用时若不传该参数则使用默认值。)*
+- **Inline Functions(内联函数)** – Declared with the keyword `inline` (or defined directly in class definition for member functions), these suggest to the compiler to expand the function body at the call site to avoid function call overhead. Useful for very short functions. Modern compilers optimize short functions automatically, so explicit `inline` is less critical. (Java inlining is handled by the JIT at runtime and not exposed in source.)
+- **Recursion(递归)** – A programming technique where a function calls itself (直接或间接调用自身). Recursive solutions have a **base case(基例)** that stops recursion and one or more **recursive cases(递归情况)** where the function calls itself with a smaller sub-problem. For example, the factorial function can be defined recursively: `factorial(n) = n * factorial(n-1)` with base case `factorial(0)=1`. Each recursive call has its own set of local variables (stack frame) on the **function call stack(调用栈)**. If recursion doesn’t converge to a base case, it results in infinite recursion (类似无限循环) and eventually a stack overflow (栈内存溢出). Recursion can produce elegant solutions for problems like factorial, Fibonacci, tree traversal, etc., but iterative solutions (使用循环) may be more efficient in some cases. C++ and Java both support recursion similarly.
+- **Recursive vs Iterative(递归与迭代对比)** – Both recursion and looping achieve repetition. **Iteration(迭代)** explicitly uses loops, modifying loop variables until a condition fails. **Recursion** uses repeated function calls, letting the runtime handle looping via the call stack. Recursion can be more readable for divide-and-conquer algorithms (分治算法), but each function call has overhead. For example, calculating Fibonacci recursively leads to many duplicate subcalls, whereas an iterative approach or memoization is more efficient. It’s important to choose the right approach based on clarity and performance. *(在Java中也是如此,递归容易栈溢出且有函数调用开销,但写法简洁; 有些算法(如遍历树结构)递归实现更直观。)*
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 只在定义所在函数内可见的变量称为 ______ 变量。【提示】这类变量是局部变量(local variable)。
+
+2. **填空题:** 在被调用函数中使用 ______ 语句可以将表达式的值传回调用函数。【提示】使用`return`语句返回值。
+
+3. **填空题:** 函数头中使用关键字 ______ 表明该函数不返回任何值。【提示】`void`关键字。
+
+4. **填空题:** 可以定义多个同名但参数不同的函数供不同数据类型使用,这称为函数 ______ 。【提示】**函数重载** (function overloading)。
+
+5. **填空题:** 使用限定符 ______ 声明的变量为只读变量(不能被修改)。【提示】用`const`限定符声明常量。
+
+6. **判断题:** 一个类可以定义多个与类同名的函数来构造对象。(对/错)【提示】**对**。类可以有多个构造函数,参数不同即构成重载。
+
+7. **判断题:** 如果函数参数需要多个值,那么函数调用时参数和形参在类型、顺序和数量上必须一一对应。(对/错)【提示】**对**。实参会按照位置依次匹配形参,类型必须兼容或可转换,否则编译错误。
+
+8. **判断题:** 用关键字`inline`声明的函数编译后一定会内联展开,不会发生函数调用开销。(对/错)【提示】**错**。`inline`只是建议,具体是否内联由编译器决定。另外,即使没声明inline,编译器有时也会优化内联。
+
+9. **判断题:** 递归和迭代都会重复执行操作,但递归可能导致较高的函数调用开销和内存占用。(对/错)【提示】**对**。递归调用频繁压栈出栈,开销较大;迭代通常更节省资源。如果递归层次太深还可能导致栈溢出。
+
+10. **找错改错:** 下列代码包含若干错误,请说明并更正。
+
+ ```cpp
+ void g() {
+ cout << "Inside function g" << endl;
+ void h() {
+ cout << "Inside function h" << endl;
+ }
+ }
+ float cube(float); // function prototype
+ cube(float number) {
+ return number * number * number;
+ }
+ ```
+
+ **提示:** 存在两个主要错误:首先,C++中不允许在函数`g`内部定义另一个独立的函数`h`(不能在函数内嵌套定义函数)。应将`h`的定义移到`g`外部。同理,每个函数的花括号必须匹配,`g`函数在定义`h`之前就应该闭合其作用域。其次,`cube(float number)`函数的定义缺少返回类型,应与前面的原型一致返回`float`。修改如下:
+
+ ```cpp
+ void g() {
+ cout << "Inside function g" << endl;
+ }
+ void h() {
+ cout << "Inside function h" << endl;
+ }
+ float cube(float number) {
+ return number * number * number;
+ }
+ ```
+
+ 以上更正包括:将`h`定义为独立的`void h()`函数,并为`cube`函数添加返回类型`float`使其与声明匹配。此外,确保每个函数的定义都有匹配的花括号闭合。经过修改,代码可正常编译,函数调用关系也清晰明确。
+
+## Lecture 6: Arrays and Vectors (第6讲:数组与向量)
+
+**Key Concepts 主要知识点:**
+
+- **Array(数组)** – A collection of elements of the **same type(相同类型)** stored contiguously in memory. Think of an array as a series of numbered boxes, each holding a value of a particular type. You refer to an element by its **index(索引/下标)**, an integer offset from the start of the array. In C++ (and many languages), array indexing starts at **0** (首元素索引为0). For example, if `int a[5];` is an array of 5 ints, valid indices are 0 through 4. The number inside `[]` is the array’s length (元素数量).
+ - **Declaring Arrays(数组声明)**: Use syntax `Type arrayName[arraySize];`. This allocates memory for `arraySize` elements of `Type`. The size must be a constant expression (编译时常量) in C++ for static arrays. It’s recommended to use a constant or `#define` for array sizes to avoid “magic numbers” (不直接使用字面值) in the code.
+ - **Accessing Elements(访问元素)**: Use the subscript operator `[]`, e.g., `a[2]` refers to the third element of array `a`. Indices must be integers (or integer expressions). Be careful: C++ does **not perform bounds-checking(不自动检查下标越界)** on array accesses. Accessing an out-of-range index causes undefined behavior (可能读取无效内存或导致程序崩溃). In contrast, Java throws an exception if you index out of bounds. Always ensure index `0 <= index < arrayLength`.
+ - **Initializing Arrays(数组初始化)**: You can initialize an array when you declare it. For example: `int b[3] = {1, 2, 3};` or `int c[5] = {0};` (initializes all 5 elements to 0). If the initializer list has fewer elements than the array, remaining elements are initialized to 0 (implicitly). If the array size is omitted, the compiler deduces it from the initializer count. *(Java数组初始化类似,但Java数组是对象,在运行时动态分配; C++静态数组在栈或静态存储上分配。)*
+ - **Constant for Array Size(常量数组长度)**: It’s good practice to use a `const` variable for array size, e.g., `const int SIZE = 10; int arr[SIZE];`. This makes the code more maintainable (eliminates “magic number”) and clearly communicates the array length. Note: In modern C++ you can also use `std::array` or `std::vector` which manage size dynamically or at compile time.
+- **Array Index (Subscript)(数组下标)** – The index is the position of an element. Also called **subscript(下标)**. The first element is index 0, last element index = size-1. Using an index outside this range leads to invalid memory access (C++不会自动抛异常,因此务必小心)。For example, if `int a[5];`, `a[5]` is an invalid access (有效索引为0~4)。
+- **Memory Layout(内存布局)** – Arrays are stored in contiguous memory. If `a` is an `int[5]`, and on a system `int` is 4 bytes, then `a[0]` is at some address `p`, `a[1]` is at `p+4`, `a[2]` at `p+8`, etc. Pointer arithmetic can be used with arrays (Lecture 7). C++ does not store the array length with the array (unlike Java which has `array.length` property). You must track the size separately.
+- **Constant vs Variable Length Arrays**: Traditional C++ (pre-C++11) required array size to be a compile-time constant for stack allocation. Some compilers allow variable length arrays (VLAs) as an extension, but the portable way for dynamic size is to allocate on heap or use `std::vector`. *(Java数组长度是在运行时确定的,通过`new`分配,C++也可以用`new`动态分配数组,或使用标准容器。)*
+- **Arrays Initialization Pitfalls(初始化注意)**: If you partially initialize (e.g., `int d[5] = {1,2};`), uninitialized elements are set to 0 in C++ for static storage or if initializer list is provided. However, if you omit an initializer entirely for a local array, the array contains **garbage values(未定义垃圾值)**. Always initialize or set values before use.
+- **const Arrays(常量数组)**: Declaring an array as `const` (e.g., `const int arr[3] = {…};`) makes its elements read-only. Alternatively, using `constexpr` for compile-time constant arrays. (Java has final arrays references, but array elements can still change unless individually final; C++ const truly makes each element constant.)
+- **Multidimensional Arrays(多维数组)** – C++ allows arrays of arrays, e.g., `int matrix[3][4];` is a 3x4 matrix (3 rows, 4 columns). Access via `matrix[i][j]`. These are stored in row-major order (行优先存储). You must specify sizes for all but the first dimension when passing to functions. Java’s multi-dimensional arrays are actually arrays of array objects (could be ragged), while C++ multi-dimensional arrays are true multi-dimension in contiguous memory (unless you use pointers to simulate jagged arrays).
+- **Static vs Automatic Arrays**: A **static local array(静态局部数组)** (declared with `static` inside a function) persists for the program’s lifetime and is zero-initialized by default. An **automatic array(自动/局部数组)** (normal local array) is created each time the function is called and destroyed on exit; it is not automatically initialized (contents are indeterminate if not set). Use static when you need to preserve values between calls or for large arrays to avoid stack usage (but then not thread-safe).
+- **Range-Based for (C++11)(基于范围的for循环)** – You can loop through an array easily: `for(int x : arr) { ... }` will iterate over each element `x` in `arr`. This is similar to Java’s enhanced for: `for(int x : arr)`. It’s read-only by default (x is a copy). Use reference (`for(int &x : arr)`) if you want to modify array elements in the loop.
+- **No Built-in Bounds Checking(无边界检查)** – Unlike Java, C++ will not throw an error if you go out of bounds on an array; it will just access whatever memory is at that address. This can lead to bugs or security issues. For safer arrays, use `std::array` (which has `.at(index)` that throws an exception on out-of-range) or `std::vector` (with `at` method). In critical applications, consider using these or adding manual checks.
+- **C-Strings vs std::string**: A C-style string is an array of `char` ending with `'\0'`. e.g., `char name[6] = "Alice";` (actually 6 elements including null terminator). Manipulating C-strings requires care (functions in `` like `strcpy`, `strlen`). `std::string` (as covered in Lecture 3) is higher-level and easier to use. When interacting with C APIs, you might convert `std::string` to C-string via `c_str()` method.
+- **Class Template `std::vector`(向量模板类)** – A dynamic array provided by the C++ Standard Library (in header ``). **`std::vector`** represents a resizable array of elements of type T. Key features:
+ - **Dynamic sizing(动态大小)**: It can grow or shrink at runtime. Start with `vector v;` and use `v.push_back(value);` to append elements. The vector manages its own memory (automatically allocates more space as needed).
+ - **Access and Capacity(访问与容量)**: Use `v[index]` to access elements (like array, but no bounds check by operator[]), or `v.at(index)` which throws `std::out_of_range` exception if index is invalid. Use `v.size()` to get current number of elements. Unlike built-in arrays, `vector` knows its length.
+ - **Initialization**: You can initialize with a size: `vector v(10);` creates a vector of size 10 (elements default-initialized, e.g., 0 for int). Or initialize with values: `vector v = {1,2,3};`.
+ - **Comparison**: Vectors can be compared with `==` and `!=` (element-wise comparison). Two vectors are equal if they have same length and all corresponding elements equal.
+ - **Copy and Assignment(拷贝与赋值)**: You can assign one vector to another (`v2 = v1;`) and it copies all elements (深度复制,每个元素都会被拷贝). There is also a copy constructor (e.g., `vector v2(v1);`) to initialize from another vector.
+ - **Memory Reallocation**: Vectors manage an internal capacity. They might allocate more capacity than size for efficiency. When size exceeds capacity, a reallocation happens (which can move the data). Thus pointers/iterators to vector elements may be invalidated when reallocation occurs. (Java’s `ArrayList` is similar in this regard.)
+ - **Bounds Checking**: `vector::at` provides bounds checking. In contrast, `operator[]` does not check bounds (for performance). Java’s `ArrayList` `get(index)` does check and throws exception if out of range.
+ - **Default initialization**: A `vector v(5);` will value-initialize the 5 ints to 0, whereas a built-in array of 5 ints (if local) would be uninitialized unless explicitly set.
+ - **Iterators**: Vectors provide iterators (like pointers) to traverse elements. Example: `for(auto it = v.begin(); it != v.end(); ++it) { cout<< *it; }`. (Similar to Java iterators, but in C++ often we use range-for instead for simplicity.)
+ - **Advantages**: `std::vector` is safer and more flexible than raw arrays. Use it unless you have a specific reason to use C-style arrays.
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 定义数组长度时应使用 ______ 来避免魔术数字(magic number)。【提示】应使用符号常量,例如`const`常量或宏。
+
+2. **填空题:** 用来引用数组特定元素的数字称为该元素的 ______ 。【提示】称为**下标**或索引(subscript/index)。
+
+3. **判断题:** 一个数组可以存储多种不同类型的值。(对/错)【提示】**错。**数组中的所有元素类型必须相同。例如,`int`数组只能存`int`,不能混存其它类型。
+
+4. **判断题:** 数组的下标值通常应使用`float`类型,以便表示更大的范围。(对/错)【提示】**错。**数组下标应使用整数类型(如`int`),浮点数不可直接作为下标(编译时会转换或报错)。
+
+5. **判断题:** 如果初始化列表中的初始值个数少于数组长度,未提供初始值的元素将被初始化为列表中的最后一个值。(对/错)【提示】**错。\**对于不足的部分,C++会将其\**初始化为0**(数值类型)而不是重复最后一个值。
+
+6. **判断题:** 如果初始化列表中的值多于数组容量,这将导致编译错误。(对/错)【提示】**对。**初始化时初始值数量不能超过数组声明的大小,否则程序无法通过编译。
+
+7. **编程题:** 定义一个大小为99的浮点数组`w`,写一个程序找出并输出该数组中的最小值和最大值。要求:给出中文解题思路。
+
+ **提示:** 可以通过一次遍历数组来同时找出最小值和最大值。具体步骤:先假设数组首元素既是最小值又是最大值,然后从第二个元素开始遍历整个数组,与当前最小值、最大值比较并更新。如伪代码:
+
+ ```
+ minVal = w[0], maxVal = w[0]
+ 对于 i 从 1 到 98:
+ 如果 w[i] < minVal,则 minVal = w[i]
+ 如果 w[i] > maxVal,则 maxVal = w[i]
+ 输出 minVal 和 maxVal
+ ```
+
+ 这样单次循环即可完成查找(时间复杂度O(n))。需要注意数组必须已填入有效的数值才能进行比较(未初始化元素不能直接比较)。在实现中,先对`w`赋值(可通过输入或随机生成等),然后应用上述逻辑得到结果。请确保访问数组时索引不越界(0到98)。*(The approach is similar in Java: one would use a loop from 0 to length-1, updating min and max accordingly.)*
+
+## Lecture 7: Pointers and Memory Management (第7讲:指针与内存管理)
+
+**Key Concepts 主要知识点:**
+
+- **Pointer(指针)** – A variable that holds a **memory address(内存地址)** as its value. If a variable `x` resides at some address in memory, a pointer can “point to” `x` by storing that address. In C++, pointers are declared with an asterisk `*`. For example, `int *p;` declares `p` as a pointer to int (能够存放某个整型变量的地址). Pointers provide **indirection(间接引用)**: they allow access to the object they point to. *(Java没有显式的指针类型;Java的引用在某种程度上类似指针,但不能进行算术运算或转换为整数地址。)*
+- **Address-of Operator `&`(取地址运算符)** – A unary operator that yields the memory address of its operand. For example, if `int y = 5;` then `&y` gives the address where `y` is stored. You can assign that to a pointer: `int *yPtr = &y;` now `yPtr` contains y’s address. Think of `&` as “give me the location of”.
+- **Dereference Operator `\*`(解引用/间接运算符)** – A unary operator used on a pointer to access the object it points to. For example, if `int *p = &y;` then `*p` refers to the same variable as `y`. So `*p = 10;` would set `y` to 10. `*` here is called the **indirection operator(间接访问运算符)**, and using `*p` is **dereferencing the pointer(解引用指针)**. *Important:* `*` has two roles in C++: declaration (to denote a pointer type) and dereferencing. The context differentiates them. *(Java does not allow direct pointer dereferencing; object references are automatically dereferenced with `.` operator to access fields/methods.)*
+- **Pointer Declaration and Initialization(指针声明与初始化)** – When declaring multiple pointers in one statement, note that the `*` applies to each variable individually: e.g., `int *p, q;` declares `p` as pointer to int and `q` as int (not a pointer). It’s clearer to separate declarations. **Always initialize pointers(初始化指针)** when declaring if possible, either to a valid address or to `nullptr` (C++11) or `NULL` (older) or `0`. An uninitialized pointer contains an indeterminate address (野指针), dereferencing it causes undefined behavior. Setting a pointer to **null pointer(空指针)** indicates it points to nothing (a safe “nowhere” value). In C++ `NULL` is typically defined as 0; C++11 introduced `nullptr` as a type-safe keyword for null pointers.
+- **Null Pointer(空指针)** – A pointer that is not pointing to any object or function. In C++ you can assign `0` or `NULL` to a pointer to make it null. Dereferencing a null pointer (`*p` when `p` is null) is invalid and will likely crash the program (访问空指针会导致运行时错误). Always check `if(p != nullptr)` (or `if(p)` since null is falsey) before dereferencing if unsure. (Java references throw `NullPointerException` if used when null; in C++ it’s just undefined behavior with no automatic check).
+- **Pointer Arithmetic(指针算术)** – Pointers can be incremented or decremented (if they point to elements of an array). For example, if `p` is an `int*`, `p++` advances `p` to point to the next integer in memory (地址增加`sizeof(int)`字节). Likewise `p + n` moves the pointer forward by n elements. Pointer arithmetic is scaled by the pointed type size. So adding 1 to an `int*` moves 4 bytes (on typical 32-bit int system), adding 1 to a `double*` moves 8 bytes, etc. This is how C-style arrays and pointers are closely related (see next point). *(Java does not support pointer arithmetic at all. All array indexing in Java is done with the index and internal checks, not by moving pointers.)*
+- **Arrays and Pointers Relationship(数组与指针的关系)** – In C++, the name of an array can decay to a pointer to its first element. For example, if `int a[10];`, then `a` (in most expressions) is treated as `int*` pointing to `a[0]`. So you can do `int *p = a;` and then `*(p+3)` is equivalent to `a[3]`. Also, `a[i]` is defined as `*(a + i)`. There is a close interplay: pointer arithmetic + dereference can simulate array indexing. Note: Arrays allocated with `new` (like `int *p = new int[10];`) should be accessed with pointer notation `*(p+i)` or as if `p` were array name `p[i]`. One key difference: a pointer is a variable (you can reassign it), but an array name is not a modifiable lvalue (不能给数组名赋新地址值).
+- **Pointer vs Reference(指针与引用)** – C++ also has **references(引用)**, declared with `&` (e.g., `int &ref = x;`). A reference is an alias to an existing variable; once initialized to refer to a variable, it cannot be changed to refer to another. References are simpler (no deref operator needed: use `ref` directly as alias), but they cannot be null and must be initialized upon creation. Pointers, on the other hand, can be reassigned, can be null, and require explicit dereferencing. Both can be used for pass-by-reference to functions, but references are generally safer and preferred for that purpose. *(Java’s object variables are more like pointers “under the hood,” but Java doesn’t allow pointer arithmetic or direct memory access. Java’s references are automatically dereferenced; you don’t see an explicit `\*` as in C++.)*
+- **Dynamic Memory Allocation(动态内存分配)** – Using **`new`** to allocate memory on the heap. For example, `int *p = new int;` allocates an `int` and returns a pointer to it. For arrays: `int *arr = new int[50];` allocates an array of 50 ints on heap. Complement with **`delete`** to free a single object (`delete p;`) or **`delete[]`** for arrays (`delete[] arr;`) to avoid memory leaks (内存泄漏). If `delete` is not called, the allocated memory remains occupied until program ends. *Java doesn’t have explicit `new`/`delete` pairing; it relies on garbage collector to reclaim unused objects.*
+- **Memory Leaks and Dangling Pointers(内存泄漏与悬空指针)** – A **memory leak(内存泄漏)** occurs if heap memory is allocated and never freed (在C++中忘记调用`delete`就丢失了指针). Over time, leaks exhaust memory. A **dangling pointer(悬空指针)** is a pointer that refers to memory that has been freed or is otherwise invalid. For example, if you `delete p;` and then still use `p` (without resetting it) – it’s pointing to deallocated memory. Accessing it is undefined behavior. Best practice: after `delete p;` set `p = nullptr;` to avoid accidental use. Smart pointers from `` (like `std::unique_ptr`) help manage dynamic memory automatically (RAII idiom).
+- **Pointer to Constant / Constant Pointer(常量指针/指向常量)** – C++ allows const qualifiers with pointers:
+ - `int * const p` is a constant pointer to int (指针自身是常量,不能改指向其他地址,但所指对象可变)。
+ - `const int * p` (or `int const * p`) is a pointer to a const int (指向常量的指针,不能通过*p修改对象,但指针本身可变)。
+ - `const int * const p` is a const pointer to a const int (指针和所指对象都不可修改).
+ These add compile-time safety (e.g., if a function shouldn’t modify what it points to, take `const T*`). Java doesn’t have an equivalent; final references in Java mean you can’t reassign the reference, but you can still modify the object’s contents if it’s mutable.
+- **Function Pointers(函数指针)** – A pointer can also point to a function’s address. Declaration syntax: `int (*fp)(int, int) = &functionName;`. This is advanced but allows passing functions as arguments (similar to delegates or lambdas in higher-level terms; C++11 has lambdas which are often easier). *(Java prior to 8 didn’t have function pointers; Java 8 introduced lambda expressions and method references to achieve similar functionality.)*
+- **Pointer Safety Enhancements (C++11)** – Use `nullptr` instead of `NULL` for clarity and type safety. Use smart pointers (`std::unique_ptr`, `std::shared_ptr`) to automatically manage `delete`. These are part of modern C++ best practices to reduce manual memory errors.
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 一元运算符`&`称为取地址运算符,用于获取其操作数的 ______ 。【提示】获取变量的**内存地址**。
+2. **填空题:** 一元运算符`*`用于指针时称为间接运算符或解引用运算符,用于获取指针所指向的 ______ 。【提示】获取指针指向的**目标对象/值**。
+3. **填空题:** 可以直接赋给指针变量的唯一整数值是 ______ ,表示该指针不指向任何有效对象。【提示】整数0(即空指针 `NULL`/`nullptr`)。
+4. **判断题:** 在C++中,指针可以指向不同类型的变量,不需要类型匹配。(对/错)【提示】**错。**指针有类型,必须与所指对象类型一致或兼容(需要时可强制转换,但一般不安全)。例如,`int*`只能指向`int`或可转换为int的地址,不能直接指向`double`。
+5. **判断题:** 指针与数组紧密相关,数组名在大多数表达式中会转换为指向其首元素的指针。(对/错)【提示】**对。**数组名可视为指向数组首元素的地址,如`a`可以作为`&a[0]`使用。因此`*(a+1)`与`a[1]`等价。
+6. **判断题:** 使用`new`运算符分配的内存必须使用`delete`释放,否则会发生内存泄漏。(对/错)【提示】**对。**每次`new`都应有相应的`delete`,否则分配的堆内存无法回收,导致内存泄漏。可使用智能指针防止忘记释放。
+7. **判断题:** C++引用(reference)类似指针,但引用一旦绑定某对象后不可更改,且不能为NULL。(对/错)【提示】**对。**引用是对象的别名,必须初始化,一经绑定无法指向别的对象,且不存在“空引用”。指针则可以在任何时候指向其他对象或设为NULL。
+8. **判断题:** 将指针加1实际上使其指向下一个内存地址。(对/错)【提示】**错**(有细微差别)。指针加1后指向下一个同类型元素的位置,不一定是下一个字节地址,而是跨过当前类型大小的字节数。例如`int*`加1跳过4字节到下一个int地址。
+
+## Lecture 8: Classes – Deeper Look (Part 1 & 2) (第8讲:更深入的类机制 上、下)
+
+**Key Concepts 主要知识点:**
+
+- **Separate Header and Implementation(头文件与实现分离)** – It is common to split a class into a **header file(头文件)** (`.h` or `.hpp`) and an **implementation file(实现文件)** (`.cpp`). The header contains the class definition (class declaration, with member function prototypes), and the implementation file contains the function definitions (函数定义) of those member functions. This separation aids maintainability: changes in implementation don’t force recompilation of code that includes the header (as long as interface remains unchanged). To use a class in multiple source files, you include the header. For example, `#include "GradeBook.h"` in any file using `GradeBook` class. *(Java没有头文件—接口和实现都在`.java`文件内; 但Java可以通过interface和implementation classes来分离定义。C++头/源分离更贴近编译过程需求。)*
+
+- **Default and Value Parameters in Constructors(构造函数默认参数)** – Constructors (and any function) in C++ can have **default arguments(默认参数)**. This allows one constructor to handle multiple cases. For instance:
+
+ ```cpp
+ class Player {
+ public:
+ Player(string name = "Anonymous", int level = 1) {
+ this->name = name;
+ this->level = level;
+ }
+ };
+ ```
+
+ With this, you can construct `Player p1;` (uses defaults "Anonymous",1), or `Player p2("Alice");` (level defaults to 1), or `Player p3("Bob",5);`. At most one default constructor exists per class (构造函数默认为一个,因为参数默认可组合成无参调用),which is one that can be called with no arguments. If you provide default values for all parameters of a constructor, that constructor becomes the default constructor. *Java doesn’t support default parameters; you must overload constructors instead.*
+
+- **Destructor(析构函数)** – A special member function with the same name as the class prefixed by `~` (如`~Player()`), called automatically when an object is destroyed (对象生命周期结束时调用). The destructor’s role is to free resources that the object may have acquired (like memory, file handles) before the object is removed from memory. Key properties:
+
+ - A class **has at most one destructor** (no overloading for destructors, no parameters, no return type). If you don’t define one, the compiler generates a default destructor that simply calls destructors of data members (for class members) and does nothing special.
+ - Destructors are called automatically in the reverse order of construction (构造相反顺序) when objects go out of scope or are explicitly deleted. For example, in stack unwinding, local objects are destroyed in the opposite order of their creation.
+ - If an object is created with `new`, its destructor is called when you `delete` that object. If created as a local (stack) object, destructor called at end of scope. For global/static objects, destructors called when program terminates (in unspecified order across translation units).
+ - If `exit()` or `abort()` is called, destructors of some objects may not execute (especially `abort()` kills program without cleanup).
+ - **Important for memory management**: If your class allocates dynamic memory (via `new`), define a destructor to `delete` that memory to avoid leaks (or better use smart pointers to manage automatically). In classes that follow RAII (Resource Acquisition Is Initialization), the destructor releases the resource. Example: a file wrapper class closes the file in its destructor.
+ *(Java has no direct destructor concept; Java uses garbage collection. For cleanup (like closing files), Java relies on `finally` blocks or try-with-resources, or overriding `finalize()` (which is deprecated in Java 9+). Finalize is not deterministic and not recommended. In contrast, C++ destructors are deterministic and key to resource management.*
+
+- **Constructor and Destructor Call Order(构造和析构的顺序)** – For automatic objects (栈对象), constructors execute when entering their scope, destructors when leaving scope (like end of function or block). When multiple objects exist:
+
+ - If objects are defined in sequence, they are constructed in that sequence and destructed in reverse sequence (后创建的先析构).
+ - For class composition (对象成员): Member objects are constructed before the enclosing class’s constructor body executes (in order of their declaration in the class) and destructed after the class’s destructor body executes (in reverse order).
+ - For inheritance: Base class constructor runs before derived class constructor, and base destructor runs after derived destructor (base part is last constructed, first destroyed since derived “contains” base).
+ - **Global and static objects**: constructed before `main` begins (order across translation units not strictly defined), destructed after `main` exits (order is reverse of construction within each translation unit).
+ - If `exit()` is used, static objects might not destruct properly; if `abort()` used, none will.
+ - In summary: 构造函数调用按声明/继承顺序向内深入,析构函数调用按相反顺序向外展开。
+
+- **Const Objects and const Member Functions(常量对象与常量成员函数)** – If you declare an object as `const` (如`const Player p;`), it cannot be modified. In particular, you can only call that object’s **const member functions(常量成员函数)**. A member function is made const by adding `const` after its parameter list, both in prototype and definition. For example,
+
+ ```cpp
+ class Player {
+ public:
+ string getName() const { return name; }
+ void setName(string n) { name = n; }
+ private:
+ string name;
+ };
+ ```
+
+ Here `getName()` is a const member function – it promises not to modify the object (编译器会强制保证函数体内不修改成员变量). You can call `getName()` on a const Player, but cannot call `setName()` because that function isn’t marked const. Const correctness helps catch unintended modifications and allows usage of objects in read-only context (like passing a const reference to a function to ensure it doesn’t modify the argument). *Java does not have const methods or const objects. Instead, immutability in Java is a design choice (like making fields private and not providing setters, or using `final` for fields, but there’s no language-enforced const for methods or objects). C++ const is a compile-time check to prevent modification through that interface.*
+
+- **Composition(组合)** – A class can have members that are objects of other classes (class A has a member of class B type). This is called a “has-a” relationship or composition (合成关系:一个类拥有另一个类的对象). For example, a `Car` class might have an `Engine` object as a member. Composition implies that the lifetime of the part (成员对象) is tied to the whole: when the Car is constructed, its Engine member is constructed; when Car is destroyed, Engine is destroyed. It’s a way to reuse classes by building complex ones from simpler ones (Car由Engine, Wheel等部件组成). *(Java also has object references as fields to achieve composition, with similar semantics aside from memory allocation differences. In Java, an object field is a reference that could be null or refer to a shared object; in C++ if you have an object member (not pointer), it’s embedded and cannot be null – it always exists as part of the containing object.)*
+
+- **Friend Functions and Friend Classes(友元函数与友元类)** – The `friend` keyword allows a non-member function or another class to access the private/protected members of a class. This is an exception to the usual encapsulation rules. For example:
+
+ ```cpp
+ class MyClass {
+ friend void secretFunction(MyClass& obj);
+ friend class MyFriend;
+ private:
+ int secretData;
+ };
+ ```
+
+ Here `secretFunction` and all members of `MyFriend` class can access `MyClass::secretData` directly. Friendship is granted, not taken: it must be declared within the class that is giving access. It’s neither symmetric nor transitive: if A is friend of B, B is not automatically friend of A; if A is friend of B and B is friend of C, A is not friend of C. **Use cases:** sometimes needed for operator overloading (to allow an external function to access privates) or if two classes need intimate access to each other’s internals. But overuse of `friend` can break encapsulation and make maintenance harder, so use sparingly. *(Java has no friend concept. Java achieves similar trust through package-private access (classes in the same package can access each other’s package-private members) or simply making members public. But there's no direct way to allow one specific external function/class access without making things globally accessible, short of nested classes. C++ friend is a targeted relaxation of access control.)*
+
+- **`this` Pointer(this指针)** – Inside a non-static member function, `this` is a pointer to the object on which the function was invoked. It has type `ClassName* const` (a const pointer to the object). You can use `this` to refer to the object’s members (especially if names are shadowed) or to return the object itself (like in operator overloading chaining). In a const member function, `this` is of type `const ClassName*`. Java similarly has a `this` reference inside instance methods, though it’s used less explicitly (commonly only for disambiguating field names or passing the current object as parameter). In C++ you often see patterns like `return *this;` in methods to allow chaining.
+
+- **Static Class Members(静态类成员)** – C++ classes can have **static data members(静态数据成员)** and **static member functions(静态成员函数)**. A static data member is essentially a global variable that is scoped to the class (所有对象共享的类级变量). It exists independently of any object instances (即使没有创建对象,静态成员也存在并可访问). You define it *outside* the class as well (one definition in a .cpp): e.g., `int MyClass::count = 0;` to allocate it. Use cases: class-wide information, like a counter of how many objects have been created (each constructor increments, destructor decrements). Static member functions are functions not tied to a specific object (no `this` pointer inside). They can only access static members (because there’s no object context). Call static members with class name: `MyClass::count` or `MyClass::staticFunc()`. *(Java’s `static` fields and methods are analogous. The main difference: C++ static data members need to be defined in one .cpp file, whereas Java static fields are defined in the class itself at declaration. Also, C++ has no direct equivalent of Java’s static initializer blocks, but you can assign initial values in the definition or use static constructors in modern C++17 (inline static initializations).)*
+
+ - If you want to call a static function or use a static data without any objects, you can do so. E.g., a class `MathUtils` could have `static double PI; static double square(double x);` and you use `MathUtils::PI` or `MathUtils::square(5.0)` directly (like Java’s `Math.PI` and `Math.sqrt()`).
+ - Static data members are initialized to 0 (for fundamental types) by default if not explicitly initialized. They live in static storage (like global variables).
+ - A common pattern is **singleton**: a class with a private static instance of itself and a static method to get that instance.
+ - Remember to define static data in one translation unit or mark it `inline` (C++17) to avoid multiple definitions error.
+
+- **Member Initializer List(成员初始值列表)** – A syntax used in constructor definitions to initialize data members (especially important for const and reference members which **must** be initialized, not assigned). For example:
+
+ ```cpp
+ class Example {
+ const int size;
+ int * data;
+ public:
+ Example(int s): size(s), data(new int[s]) { /*...*/ }
+ };
+ ```
+
+ The part `: size(s), data(new int[s])` is the initializer list. It initializes `size` and `data` **before** the constructor body runs. Benefits:
+
+ - Efficiency: avoid default-constructing then assigning. For complex members, initialization can be faster than default construct + assignment (especially for objects of classes as members).
+ - Necessity: const and reference members cannot be assigned in constructor body; they must be initialized in the initializer list. Static data members cannot be initialized in the initializer list (they’re handled separately at definition).
+ - Order: Members are initialized in the order of their declaration in the class, not the order in the initializer list. It’s wise to list them in same order to avoid confusion.
+ *(Java has no equivalent because instance fields can be assigned in body or an init block, but effectively Java does initialization before constructor body too, except you don’t control the order beyond writing them in code order. Java final fields must be assigned by constructor completion but you usually just do it in constructor body or inline initializers, no special syntax needed.)*
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 若要允许一个非成员函数访问类的私有成员,可以在类定义中将该函数声明为 ______ 函数。【提示】声明为该类的**友元(friend)**函数。
+2. **填空题:** 对象的非静态成员函数可以通过一个隐含的“自我指针”访问所属对象,该指针称为 ______ 指针。【提示】称为`this`指针。
+
+*(Lecture 8 slides did not explicitly list many exercise questions beyond friend and this pointer fill-in, so we focus on those.)*
+
+**Suggested Answers 答案:** 1) **友元**函数; 2) **this**指针。请注意,`friend`关键字可以使指定的函数或类突破封装直接访问私有成员,但应谨慎使用。`this`指针在C++中是隐含参数,用于指向调用该成员函数的对象地址,在需要时可显式使用,如返回`*this`实现链式调用。
+
+## Lecture 9: Operator Overloading (第9讲:运算符重载)
+
+**Key Concepts 主要知识点:**
+
+- **Operator Overloading(运算符重载)** – C++ allows giving operators like `+`, `-`, `==`, `<<`, etc., custom meanings for user-defined types (为用户自定义类型定义运算符功能). This enhances expressiveness – e.g., you can use `a + b` for two complex numbers or concatenate two strings with `+` if you define it. In C++, most operators can be overloaded except a few (notably `.` member access, `.*` pointer-to-member, `::` scope resolution, `?:` ternary, and `sizeof` cannot be overloaded). To overload an operator, you define a function with special name `operatorX` where X is the operator symbol. For example:
+
+ ```cpp
+ class Complex {
+ public:
+ Complex operator+(const Complex& rhs) const {
+ return Complex(real + rhs.real, imag + rhs.imag);
+ }
+ };
+ ```
+
+ This overloads `+` for Complex addition. Then `c1 + c2` calls this function (as a member function on `c1` with argument `c2`). Some operators are best overloaded as member functions (like assignment `operator=` must be member) and some as friend or free functions (like `operator<<` for streams, since left operand isn’t a class object but an `ostream`).
+
+ - **Syntax**: If a binary operator is overloaded as a member, it takes one parameter (the right-hand side). If as a free function, it takes two parameters (left and right). For symmetric operations, free function can be friend for access.
+
+ - **Rules**: You cannot change operator precedence or associativity, and you cannot create new operators – only overload existing ones. The overloaded operator’s arity (unary/binary) and meaning should be intuitive.
+
+ - **Example**: Overloading `<<` for output:
+
+ ```cpp
+ std::ostream& operator<<(std::ostream& os, const Complex& c) {
+ return os << c.real << "+" << c.imag << "i";
+ }
+ ```
+
+ This allows `cout << complexObj;` to print a Complex. Usually `operator<<` is a non-member (cannot be member of std::ostream or Complex), hence made a friend of Complex to access privates.
+
+ - **Operator=**: If you define custom copy semantics, overload assignment operator. If not, C++ provides a default member-wise copy assignment. Similarly, you can overload `operator==` to compare objects meaningfully (default does bitwise compare? Actually default `==` not generated, must overload for user types).
+
+- **Conversion Operators(类型转换运算符)** – You can define `operator type()` in a class to convert an object to another type implicitly. E.g., `operator int() const { return value; }` in a class would allow an object to be used where int is expected. Use carefully – implicit conversions can introduce ambiguities or unexpected results. (In Java, you can’t overload casting or define implicit conversions; you must use explicit methods).
+
+- **Explicit Keyword** – In C++11 and above, you can mark single-parameter constructors as `explicit` to avoid them being used as implicit conversions. Similarly, conversion operators can be marked explicit (C++20) to require explicit cast. This prevents unintended conversions. (Java doesn’t have an equivalent since no user-defined implicit conversions exist.)
+
+- **Overloading vs Overriding** – Operator overloading is about same operator symbol working on different types (ad-hoc polymorphism). It’s resolved at compile time by checking operand types. This is different from overriding virtual functions (runtime polymorphism, Lecture 11). (Java doesn’t have operator overloading at all, so less confusion there; C++ needs careful distinction between overload vs override – hence `override` keyword introduced for clarity in virtual functions override).
+
+**After-class Exercises 课后练习:**
+
+1. **填空题:** 要重载一元或二元运算符,需要定义一个名为 ______ 的函数。【提示】函数名形式为`operator+`、`operator==`等,例如重载`+`则函数名为`operator+`。
+2. **判断题:** 运算符重载可以改变运算符的优先级从而影响表达式求值顺序。(对/错)【提示】**错。**重载运算符不会改变其既定的优先级和结合性,表达式求值规则保持不变。
+3. **判断题:** Java允许用户为自定义类重载运算符。(对/错)【提示】**错。**Java不支持运算符重载,除了`+`用于字符串连接是语言内置特例外,其他运算符不可重定义。
+
+*Answers 答案:* 1) 形如`operator+`的函数名(以`operator`加运算符符号命名); 2) 错;3) 错。请记住,C++运算符重载应遵循直观原则,例如`operator+`应实现类似“加法”的语义。不能重载的新运算符包括`.`、`::`、`?:`等。而在Java中运算符重载不可用,只能通过定义方法实现类似功能(例如用`add()`方法代替重载`+`号)。
+
+## Lecture 10: Inheritance (Extending Classes) (第10讲:继承 – 扩展类)
+
+**Key Concepts 主要知识点:**
+
+- **Inheritance(继承)** – A mechanism for creating a new class (子类/派生类) from an existing class (基类/父类), absorbing its attributes and behaviors and optionally adding new features or overriding existing ones. In C++, class inheritance is specified with a **colon and access specifier**. Example: `class Student : public Person { ... };` means Student **inherits publicly from** Person (Student *is-a* Person). Key points:
+
+ - The derived class automatically has the data members and member functions of the base class (though private members of base are not accessible directly in derived, they are present but hidden). Public and protected base members become part of the derived class interface (public stays public, protected stays protected if using public inheritance).
+ - **Access specifier (public/protected/private) in inheritance**: This determines how the base’s public/protected members are treated in derived.
+ - **Public Inheritance 公有继承**: The most common form. Base class’s public members remain public in derived, protected remain protected. This models an “is-a” relationship: a Student is a Person, so it should be usable wherever a Person is expected (Liskov Substitution Principle).
+ - **Protected Inheritance 受保护继承**: Base public and protected become protected in derived. Not common; essentially, you don’t want outside code to treat the derived as the base type.
+ - **Private Inheritance 私有继承**: Base public and protected become private in derived. It’s more of a composition (“implemented in terms of”) than an is-a; not polymorphic. Rarely used except in certain design patterns or when you want to hide base interface.
+ *(Java only has a concept similar to public inheritance. All Java classes extend a base (explicit or `Object` implicitly), and all public/protected remain accessible in subclass. Java doesn’t allow changing the access level of inherited members except you cannot reduce visibility of an overridden method.)*
+ - **Single vs Multiple Inheritance**: C++ supports multiple inheritance (一个子类可同时继承多个基类). Syntax: `class C : public A, public B { ... };`. This can lead to complexities like **diamond problem** if both A and B inherit from a common base (C++ resolves with virtual inheritance if needed). Java forbids multiple class inheritance; it allows multiple interfaces instead (interfaces are like pure abstract base classes).
+ - **Inheritance Hierarchies(继承层次)**: Classes can be derived multiple levels (子类的子类, etc.). At the root, often an abstract base class (see polymorphism in Lecture 11).
+ - Use inheritance when there is a clear generalization-specialization relationship (一般和特殊的关系). For example, `Person` as base, `Student` and `Teacher` as derived, sharing common attributes of Person but adding their own.
+
+- **Protected Members(保护成员)** – In C++, `protected` access means the member is accessible within the class and its derived classes (and also within the same module as friend or within same class scope). Protected is a way to allow subclasses to use base internals but keep them hidden from outside world. In Java, `protected` means accessible to subclasses *and* also to classes in the same package. C++ has no package concept, so protected is strictly subclass access (plus friend). Protected is useful when you want an inheritor to have some degree of access for convenience, but you don’t want the general user (via a base class reference) to access those members.
+
+- **Base and Derived Constructors(基类与派生类构造)** – When you instantiate a derived class object, the **base class constructor runs first** to initialize the base part of the object, then the derived class’s constructor runs. The derived constructor can call a specific base class constructor using an initializer list:
+
+ ```cpp
+ class Student : public Person {
+ public:
+ Student(string name, int gradYear) : Person(name), graduationYear(gradYear) { }
+ ...
+ };
+ ```
+
+ If a base constructor requires arguments, you *must* call it explicitly in the initializer list. If you don’t call any, C++ tries to call the base’s default constructor implicitly. Similarly, **destructors** execute in reverse: first the derived’s destructor, then the base’s destructor. This ensures proper construction/destruction chain. *(Java automatically calls the base class constructor (no syntax for choosing base constructor except via `super()` call as first line in subclass constructor). If you don’t call `super(...)` explicitly, Java inserts a call to the no-arg super constructor. C++ similarly calls default base ctor if not specified.)*
+
+- **Overriding and Hiding(重写与隐藏)** – If a derived class defines a method with the same signature as a base class **virtual** method, it **overrides(重写)** that method (when called through a base pointer/reference, the derived version is used at runtime – see Lecture 11 on polymorphism). If the base method is not virtual (just a normal function), then defining a same name in derived results in **hiding** (also called shadowing) – which is not polymorphic; it simply means if you call that function on a derived object (statically typed as derived), you get the derived version, but if you call it on base or through a base pointer, you get base version because static binding. To override properly, the base function should be virtual.
+
+ - C++11 introduced the `override` keyword to explicitly mark overriding functions; the compiler will error if it doesn’t actually override a base virtual. Use this to avoid mistakes (accidental signature mismatch). Java by default treats all non-final instance methods as virtual and overrides them if signatures match in subclass. Java’s `@Override` annotation is like C++ `override` to catch errors.
+ - Also note: In C++, if you overload a function name in derived with a different signature, it *hides* all base class functions of the same name (even those with different signatures) from the scope. You can bring them in with `using Base::functionName;` if needed. Java doesn’t have this exact issue because name resolution is always at compile-time by full signature, and methods with different sig are simply overloads existing in class. C++ name hiding is a quirk due to separate compilation and might require `using` to fix.
+
+- **Multiple Inheritance and Virtual Base Classes(多重继承与虚基类)** – If a class inherits from two classes that have a common base, the default is you get two copies of that base in the derived object (ambiguity which one to use). C++ allows **virtual inheritance** to solve the diamond problem, so the common base is shared (one subobject). Syntax: `class MyClass : virtual public BaseClass { ... };`. Virtual inheritance ensures only one base subobject even if base appears multiple times in hierarchy. This is advanced and only needed in certain MI scenarios. Java’s way to avoid diamond is by not allowing multiple inheritance of classes at all (interfaces don’t have state so diamond doesn’t cause state duplication).
+
+- **Polymorphism preview** – (Though more in Lecture 11) Under inheritance, a derived object can be treated as a base object. You can assign a `Derived*` to a `Base*` (implicit upcast), or call a function expecting a Base reference with a Derived object. This is core to substitutability. If the function is virtual, the derived override will execute (if polymorphism is set up). If not virtual, base version executes (static binding). Non-polymorphic inheritance is essentially reuse of code without runtime flexibility.
+
+**After-class Exercises 课后练习:**
+
+1. **判断题:** 在公有继承下,基类的`public`成员在派生类中变为`private`。(对/错)【提示】**错。**公有继承不会降低可见性,基类public成员在派生类中仍为public;protected成员在派生类中仍为protected。只有`private`继承才会将基类的public和protected成员变为private。
+2. **判断题:** C++允许一个类同时继承自多个基类。(对/错)【提示】**对。**C++支持多重继承,一个派生类可有多个直接基类。但要注意可能出现“菱形继承”问题,需要虚继承解决。Java不支持类的多继承。
+3. **判断题:** 可以使用基类类型的指针或引用指向派生类对象。(对/错)【提示】**对。\**派生类对象\**是**一种基类对象,因此基类指针/引用可指向派生对象(向上转型),这实现了多态的基础。通过基类指针调用虚函数会执行派生类覆写的版本(见Lecture 11)。
+
+*Answers 答案:* 1) 错;2) 对;3) 对。请注意,在使用基类指针指向派生对象时,若调用非虚函数,则只会执行基类实现(静态绑定);只有虚函数才会多态地调用派生实现。良好的面向对象设计在继承层次中运用`public`继承表示”is-a”关系,并尽量避免使用`protected`或`private`继承。此外,尽管C++允许多继承,但设计时需谨慎,Java通过接口解决多继承需求,这在C++中也可以用组合(composition)或虚继承达到类似目的。
+
+## Lecture 11: Polymorphism and Virtual Functions (第11讲:多态与虚函数)
+
+**Key Concepts 主要知识点:**
+
+- **Polymorphism(多态)** – Literally "many forms". In OOP, it refers to the ability to treat objects of different derived classes through a common base class interface, and have the correct overridden functions called according to the actual object type at runtime. Polymorphism enables you to **“program in the general rather than the specific”(面向抽象编程,而非面向具体实现)**. The primary mechanism for polymorphism in C++ is **virtual functions(虚函数)**.
+
+ - Polymorphism lets you write code that works on base class pointers/references but actually processes derived class objects. For example, you might have a `Shape` base class with a virtual `draw()` method, and derived classes `Circle`, `Square` override `draw()`. If you store various shapes in an array of `Shape*` and call `draw()` on each, the appropriate derived class implementation executes (circle draws a circle, square draws a square).
+ - This relies on late binding (动态绑定): the decision of which function body to execute is made at runtime based on the actual object type, not at compile time (静态类型是基类,但对象实际类型是子类). Without virtual, C++ would do early binding (静态绑定) and call the base version always when using base pointer.
+ - Polymorphism usually goes hand in hand with **inheritance(继承)** and **virtual functions**.
+
+- **Virtual Functions(虚函数)** – Declared with keyword `virtual` in the base class, these functions are intended to be overridden in derived classes. A virtual function call is resolved dynamically at runtime via the **vtable(虚函数表)** mechanism. For example:
+
+ ```cpp
+ class Base {
+ public: virtual void foo() { cout<<"Base"; }
+ };
+ class Derived : public Base {
+ public: void foo() override { cout<<"Derived"; }
+ };
+ ```
+
+ Now, `Base* p = new Derived(); p->foo();` will print "Derived" because `foo` is virtual. If `foo` were not virtual, it would print "Base" (static binding).
+
+ - To override a virtual function in C++, the signature must match exactly (aside from `override` or covariant return). Marking the override with `override` (optional but recommended C++11) helps catch errors.
+ - **Pure Virtual Functions(纯虚函数)**: `virtual void foo() = 0;` in a class makes it abstract – no implementation in base, derived classes must override it to be concrete. A class with any pure virtual is an **abstract class(抽象类)**, cannot be instantiated. This is similar to Java’s abstract methods and abstract classes. Pure virtual functions allow defining an interface that derived classes must implement.
+ - Virtual functions can be overridden to provide specialized behavior in subclasses. If a subclass does not override a virtual, it inherits base’s implementation. You can call base class version from derived if needed (explicitly `Base::foo();`).
+ - If a derived class fails to override a pure virtual, that derived remains abstract. All concrete (非抽象) derived classes must override all base class pure virtuals.
+ - **Virtual Destructor**: If a class is meant to be a base class (especially if delete via base pointer is possible), declare a virtual destructor. This ensures that deleting a derived object through a base pointer calls the derived’s destructor fully. In polymorphic base classes, the destructor should be virtual to avoid resource leaks. (Java has GC, so no concept of destructors; all objects properly finalize when collected. But if Java had manual deletion, their Object class’s finalize is akin but not the same. C++ requires explicit management).
+
+- **Dynamic Binding and Vtable(动态绑定与虚函数表)** – At runtime, polymorphic objects carry a pointer to a vtable (a table of function pointers for virtual functions). When you call a virtual function, it uses the vtable of the actual object’s class to jump to the right function. This indirection is why calls through base pointers go to derived overrides. Implementation detail: typically the first element of an object of a class with virtual functions is a vptr (虚指针) pointing to the table. (Java’s method dispatch is similar in concept; all non-static, non-final methods in Java use a vtable-like mechanism for dynamic dispatch). The cost is one pointer dereference; negligible in most cases.
+
+- **Polymorphic Interface and Extensibility** – Polymorphism allows writing code that doesn’t need to know exact subclasses in advance. For example, a function `printShapeArea(Shape& s)` can call `s.area()` and get correct result for Circle, Square, etc., without separate code for each. Adding new Shape types (Triangle, etc.) doesn’t require changing `printShapeArea` – it’s **extensible(易扩展)**. This is the Open-Closed Principle: modules open for extension (via new subclasses) but closed for modification. Polymorphism in C++ and Java achieves that.
+
+- **Upcasting and Downcasting(向上转型与向下转型)** – **Upcasting** is converting a derived object reference/pointer to a base type (安全且隐式进行). This is how we store derived in base pointer for polymorphism. **Downcasting** is converting base reference/pointer to a derived type. In C++, use `dynamic_cast(basePtr)` for a safe downcast (it returns nullptr if object isn’t actually a `Derived`). This requires the base class to have at least one virtual function (so it has RTTI info). In Java, downcast uses `(Derived) baseRef`, which throws `ClassCastException` if the object isn’t that type. The logic is similar: check actual type at runtime. If downcasting, ensure the object is indeed that subclass (via `dynamic_cast` or other means). Minimizing downcasts is often a design goal (rather use polymorphic virtual calls).
+
+ - **`typeid` and RTTI**: C++ provides `typeid` to get type info at runtime (for polymorphic types yields actual type). Java has `instanceof` or `getClass()`.
+ - If you find you need to downcast often, consider if virtual functions could handle the variation instead (polymorphism intended to reduce explicit type checking).
+
+- **Abstract Base Classes(抽象基类)** – A class with one or more pure virtual functions. It serves as an interface (perhaps partial implementation) that cannot be instantiated. Only concrete subclasses (classes implementing all pure virtuals) can be instantiated. Abstract classes in C++ correspond to abstract classes in Java (with abstract methods). They allow defining interfaces. For example, an abstract `Shape` with pure virtual `draw()` and `area()`, implemented by concrete `Circle`, `Rectangle`, etc. Attempting to create a `Shape` object would be a compile error (just like `new Shape()` illegal in Java if Shape is abstract).
+
+- **Virtual Inheritance of Destructors** – Emphasizing: if a class is meant to be base class (polymorphic), declare virtual destructor. If not, deleting derived via base pointer is undefined (the base destructor will run but not the derived’s portion). Polymorphic base classes typically have at least one virtual, so destructor should be virtual as well. (Java doesn’t have this issue because all objects are tracked by GC; you don’t manually delete and all parts get collected.)
+
+**After-class Exercises 课后练习:**
+
+1. **判断题:** 若基类的成员函数被声明为虚函数,则通过基类指针调用派生类对象的该函数时,会执行派生类版本。(对/错)【提示】**对。**虚函数调用会在运行时绑定到对象实际类型的实现。如果没有将其声明为virtual,则不会发生多态。
+2. **判断题:** 含有纯虚函数的类是抽象类,不能直接创建对象。(对/错)【提示】**对。**抽象类必须被继承并实现纯虚函数才能实例化对象。
+3. **判断题:** 通过基类指针删除派生类对象时,应确保基类析构函数为虚函数,否则可能导致资源未正确释放。(对/错)【提示】**对。**基类析构应为virtual,以便delete时调用派生类析构函数。否则行为未定义,通常会导致只执行基类析构,派生部分没释放,造成内存泄漏或错误。
+4. **填空题:** 要求所有派生类必须覆写某函数,可将该函数在基类中声明为 ______ 。【提示】将函数定义为纯虚函数(pure virtual),语法是在函数声明末尾加`=0`。
+5. **填空题:** C++中,将`Base*`指针安全地转换为指向其派生类型对象的指针,应该使用的运算符是 ______ 。【提示】使用运行时类型识别的`dynamic_cast`。例如`dynamic_cast(basePtr)`。
+
+*参考答案:* 1) 对; 2) 对; 3) 对; 4) **纯虚函数**; 5) **dynamic_cast**。以上强调:**多态**让我们可以通过基类接口操作不同派生类对象,并自动调用恰当的实现。在设计类层次时,基类应尽可能将接口函数声明为virtual,并在需要强制子类实现时使用纯虚函数将类抽象化。另一方面,如果类不打算作为基类使用,则无需将析构函数声明为虚的,这样略微减少虚表开销。Java程序员转到C++需特别注意虚函数的声明和`override`关键字的使用,以避免逻辑错误。另外,在需要判断对象实际类型时,C++的`dynamic_cast`相当于Java的强制类型转换加`instanceof`检查,它返回nullptr表示类型不匹配,而Java则抛出异常。通过合理使用多态,可极大提高代码的扩展性和可维护性。
\ No newline at end of file
diff --git a/山东理工大学/其他/前端.md b/山东理工大学/其他/前端.md
new file mode 100644
index 0000000..bd725b3
--- /dev/null
+++ b/山东理工大学/其他/前端.md
@@ -0,0 +1,32 @@
+## BOM broswer
+
+学习的是window 的属性以及window的API
+
+```html
+
+
+
+
+
+
+
+
+
+
+