
备战
比锅
这个作者很懒,什么都没留下…
展开
-
c++结构体
转自下面第二种定义后,可这样初始化:Stu={"xxx", 1.0, 1.0};//定义一个结构体,类型为struct Student struct Student { string name; double eng; double ch; }; //定义了一个结构体,类型为struct Student;且定义了一个结...转载 2018-03-20 19:01:42 · 332 阅读 · 0 评论 -
c++getline()、get()等
此文转自在学习C++的过程中,经常会遇到输入输出的问题,以下总结一下下面几个函数的用法: 1)、cin 2)、cin.get() 3)、cin.getline() 4)、getline() 5)、gets()1、cin>> 用法1:最基本,也是最常用的用法,输入一个数字: #include <iostream> using namespace std; main (转载 2018-03-26 15:09:25 · 39523 阅读 · 10 评论 -
c++STL
vector: - v(n,ele) : 创建长度n,并且全部初始化为ele(只有在创建时可以vector< type > xx (n,ele)) - v(v1) : 拷贝v1 - v.resize(n,val) : 重新设置长度,并每个填上val值(可选),若超出capacity,自动内存分配list: - l.push_front(ele):ele压入头 -...原创 2018-03-21 21:17:21 · 145 阅读 · 0 评论 -
备战1
递归:结束条件+子递归多项式直接暴力数组,index为指数,值为系数输入时尽量把要输出的信息都采集到而结构体中(时间、排名…)时间用int表示(秒),计算设置相对0起点结构体定义struct xx{…} s[1000];直接初始化了结构体数组string比较用strcmp()<0 (#include ...原创 2018-03-24 19:47:00 · 149 阅读 · 0 评论 -
备战2
–round()、floor()、ceil 2.1 2.6 -2.1 -2.6 floor : 不大于自变量的最大整数 2 2 ...原创 2018-03-23 21:46:15 · 192 阅读 · 0 评论 -
(普通)二叉树知前中序求后序,后中序求前序,(二叉搜索树的)前序求后序
来自柳婼 输出层序的话可以用数组每层遍历存储,参考PAT甲级1020已知后序中序输出前序#include <iostream>using namespace std;int post[] = {3, 4, 2, 6, 5, 1};int in[] = {3, 2, 4, 1, 6, 5};void pre(int root, int start, int end)...转载 2018-03-23 21:20:43 · 183 阅读 · 0 评论