摘要: Vim学习 // 增 a/A 在光标后增加append 向末尾增加 i/I 在光标前插入insert 向行最前面增加 o/O 下面新开一行,并进入编辑模式 open a line 上面新开一行 // 删 d 删除delete dd 删除一行 dw 删除一个单词 delete word x 删除一个字 阅读全文
posted @ 2021-01-06 15:56 happy_fan 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 2020刷题 动态规划 基本思想 问题的最优解如果可以由子问题的最优解得到,则可以先求子问题的最优解,再构造原问题的最优解;若原问题有较多的重复出现,则可以自底向上从最终子问题向原问题逐步求解。 斐波那契数列 leetcode地址 #include <iostream> #include <vect 阅读全文
posted @ 2020-09-25 23:41 happy_fan 阅读(116) 评论(0) 推荐(0) 编辑
摘要: malloc实现对象的构造函数 #include <iostream> #include <cstdlib> using namespace std; class A{ public: int num; A(int x):num(x){} ~A(){} void p(){ cout << num < 阅读全文
posted @ 2020-09-15 20:07 happy_fan 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 快排算法 #include <iostream> #include <vector> #include <algorithm> using namespace std; int partition(vector<int> &vec, int left, int right){ int element 阅读全文
posted @ 2020-09-01 22:24 happy_fan 阅读(113) 评论(0) 推荐(0) 编辑
摘要: beego go go 调试环境1 调试环境2 一个例子 package main import "fmt" func main() { fmt.Println("Hello, World!") } 基本语法 注意:在go中声明的变量必须使用,不然会报错。当某些参数不想使用时,使用 _ 代替 注意: 阅读全文
posted @ 2020-08-02 22:03 happy_fan 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 多态 运算符重载 重载为类的非静态成员函数; 重载为非成员函数。 双目运算符重载为成员函数 如果要重载 B 为类成员函数,使之能够实现表达式 oprd1 B oprd2,其中 oprd1 为A 类对象,则 B 应被重载为 A 类的成员函数,形参类型应该是 oprd2 所属的类型。 经重载后,表达式 阅读全文
posted @ 2020-07-26 15:59 happy_fan 阅读(122) 评论(0) 推荐(0) 编辑
摘要: IO流与流类库 IO流概念 流是信息流动的一种抽象, 在程序中的对象、文件对象 之间相互流动 流对象与文件操作 程序建立一个流对象 指定这个流对象与某个文件对象建立连接 程序操作流对象 流对象通过文件系统对所连接的文件对象产生作用。 提取与插入 读操作在流数据抽象中被称为(从流中)提取 写操作被称为 阅读全文
posted @ 2020-07-26 15:58 happy_fan 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 异常处理 异常处理的思想 #include <iostream> using namespace std; int divide(int x, int y) { if (y == 0) throw x; return x / y; } int main() { try { cout << "5 / 阅读全文
posted @ 2020-07-26 15:57 happy_fan 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 继承与派生 吸收基类成员 改造基类成员 新增派生类成员 class 派生类名:继承方式 基类名 { 成员声明; } class Derived: public Base { public: Derived (); ~Derived (); }; 继承方式 公有继承 基类的public和protect 阅读全文
posted @ 2020-07-25 22:33 happy_fan 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 模板 函数模板 相比于函数的重载,减少了代码的冗余 template <class T> //定义函数模板 void outputArray(const T *array, int count) { for (int i = 0; i < count; i++) cout << array[i] < 阅读全文
posted @ 2020-07-23 00:21 happy_fan 阅读(184) 评论(0) 推荐(0) 编辑