摘要:
有时候在设计数据结构的时候,可能会遇到两个类需要相互引用的情形。比如类 A 有类型为 B 的成员,而类 B 又有类型为 A 的成员。 那么这种情形下,两个类的设计上需要注意什么呢? 同一文件 尝试方案 将 A 和 B 的定义都放在一个文件中,例如: #include <iostream> class 阅读全文
摘要:
#ifndef 它是 if not define 的简写,是宏定义的一种,实际上确切的说,这应该是预处理功能三种(宏定义、文件包含、条件编译)中的一种 条件编译。 在 c 语言中,对同一个变量或者函数进行多次声明是不会报错的。所以如果 h 文件里只是进行了声明工作,即使不使用# ifndef 宏定义 阅读全文
摘要:
Lecture4 What are streams? “stream: an abstraction for input/output. Streams convert between dataand the stringrepresentation ofdata.” 流: 对输入输出的一种抽象。留 阅读全文
摘要:
lecture8 Template Classes + Const Correctness Classes Recap “Template Class: A class that is parametrized over some number of types. A class that is c 阅读全文
摘要:
lecture7 class 类简介 “Class: A programmerdefined custom type. An abstraction of an object or data type.” 类:由程序员定义的特殊类型。是对一种对象或者数据类型的抽象 但是这个问题已经有struct 了 阅读全文
摘要:
cf red and blue 题目链接 题目大意: 思路: 将数组先按颜色,再按大小升序排序所得形式类似于 其中根据贪心只要能出现1~n的序列即可 在颜色B下,\(a[i] >= i + 1\) 因\(a[i]\)只能取不大于自身的数 在颜色R下,\(a[i] <= i + 1\) 因\(a[i] 阅读全文