08 2020 档案
摘要:关于二叉树的构建及基本操作 struct BinaryTreeNode { int m_nValue; BinaryTreeNode* m_pLeft; BinaryTreeNode* m_pRight; }; BinaryTreeNode* CreateBinaryTreeNode(int val
阅读全文
摘要:关于cin.peek()用法的总结 cin.peek()的返回值是一个char型的字符,其返回值是指针指向的当前字符,但它只是观测 指针停留在当前位置并不后移;如果要访问的字符是文件结束符,则函数值是EOF(-1) #include<iostream> using namespace std; in
阅读全文
摘要:关于二叉树四种遍历方式的核心代码 1、前序遍历 //preOrder: void PrintPreOrder(BinaryTreeNode* pNode) { if (pNode == nullptr) return; BinaryTreeNode* pCurrent = pNode; std::c
阅读全文
摘要:关于vector赋值的问题总结(c++) 具体用法如下,其实有一点比较重要,就是可以用下面代码中std::vector<double>y(n);//给定vector大小这种形式在一定程度上代替数组,因为指定数组的大小必须要为常量,vector可以用已有确定值的变量。 #include <iostre
阅读全文