![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 68
Lsiree
这个作者很懒,什么都没留下…
展开
-
图
1. 类与头文件class Graph { vector<int> citys; //城市 unordered_map <int, int> cityIndex; //城市与其对应的索引 vector<vector<int>> graph; //图public: //参数为城市,和城市之间的连接情况 void initGraph(vector<int> &citys, vector<vector<int>&g原创 2021-01-15 22:37:06 · 72 阅读 · 0 评论 -
二叉树
1. 二叉树结构体struct TreeNode { int val; TreeNode* left; TreeNode* right; TreeNode(int x) :val(x), left(NULL), right(NULL) {}};class BTREE { //含根节点的二叉树类private: TreeNode* root;public: TreeNode* getRoot();};2. 创建二叉查找树void BTREE::buildTree(vector&原创 2021-01-12 16:16:48 · 114 阅读 · 0 评论 -
C++笔记
参数缺省值1.注意:参数缺省值必须放在函数参数的最后否则就没有意义了如func(int a = 1, int b),每次传参为了传入b必然要传两个参数,设置a的缺省就没有意义了2.默认参数一般在函数声明中提供。如果程序中既有函数的声明又有函数的定义时,则定义函数时不允许再定义参数的默认值。void fun(int x = 0,int y = 0);void fun(int x = 0, int y = 0) { } // error C2572: “fun”: 重定义默认参数 : 参数 2/原创 2020-12-19 15:58:06 · 290 阅读 · 0 评论