摘要: 一、派生类 派生类有基类所有的成员函数,成员变量 二、格式 阅读全文
posted @ 2018-11-25 21:44 shenyuli 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 一、cin重载 1.cin为ostream类的成员 2.cin重载应为全局函数(毕竟ostream是别人写好的) 3.代码 a.核心代码 b.完整试例 二、cout重载 1.核心代码 2.完整试例 阅读全文
posted @ 2018-11-25 21:22 shenyuli 阅读(1937) 评论(0) 推荐(0) 编辑
摘要: 1.核心代码 class Kmp { public : string s; string t; int next[maxn]; void get_next() { int i=-1,j=0,lent=t.size(); next[j]=-1; while(j<lent-1) { if(i 1||t[ 阅读全文
posted @ 2018-11-25 19:19 shenyuli 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 一、this指针 this指向本身作用的对象 二、友元 friend 1.友元函数:一个类的友元函数可以访问该类的私有成员 (友元可以是普通全局函数,也可以是别的类 的成员函数) 2.友元类:该友元类所有函数有权访问 类的所有私有成员 阅读全文
posted @ 2018-11-23 20:59 shenyuli 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 一、格式 二、试例 阅读全文
posted @ 2018-11-23 20:09 shenyuli 阅读(1771) 评论(0) 推荐(0) 编辑
摘要: 注意:下标必须是人物编号,且从1—INF 1.核心代码: #include<iostream> using namespace std; const int maxn=1000; class Ufstree { struct node { int data; int rank; int par;// 阅读全文
posted @ 2018-11-22 19:25 shenyuli 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 对象:有向图(有无权无所谓) 存储方式:邻接表(最好写罢了,空间也比较少) 核心代码: void topsort(adjgraph g) { int i,j; int visited[maxn]={0}; int st[maxn],top=-1; arcnode *p; for(int i=0;i< 阅读全文
posted @ 2018-11-21 19:24 shenyuli 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 适应对象:有权图(有向或无向都行) 图存储方式:邻接矩阵(有0和INF的那种,否则就over) 一、Floyd算法: 1。核心代码: void floyd() { int i,j,k; for(i=0;i<g.n;i++) for(j=0;j<g.n;j++) { dist[i][j]=g.edge 阅读全文
posted @ 2018-11-21 16:58 shenyuli 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 对象:无权图,可不连通 一、DFS 1. 邻接矩阵 a.核心代码: b.例题地址:http://120.77.243.165/problem.php?id=3956 #include<iostream> using namespace std; const int maxn=100; class G 阅读全文
posted @ 2018-11-20 20:35 shenyuli 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 矩阵: 邻接表: struct arcnode { int adjvex; int weight; arcnode *nextarc; }; struct vnode { int info; arcnode *firstarc; }; struct adjgraph { vnode adjlist[ 阅读全文
posted @ 2018-11-20 19:30 shenyuli 阅读(140) 评论(0) 推荐(0) 编辑
Live2D