C++
IUVGood
此人不懒,但什么都没有写
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
cin、cout、scanf、printf函数计算顺序
cin、cout、scanf、printf计算顺序都是从右向左进行计算、然后从左向右进行输入和输出。vs2015#include <iostream>#include <string>using namespace std;int main(){ char a[10] = { 'a','b','c','d'}; char* p = a; cin &...原创 2019-08-04 15:47:44 · 1314 阅读 · 0 评论 -
C++面试汇总中...
1、C++new与malloc的10点区别https://www.cnblogs.com/ywliao/articles/8116622.htmlint *p = (int*)malloc(sizeof(int)); //申请 memset(p, 0, sizeof(int)); //赋值 free(p); //释放 int *q = new int; //申请 *q = 1; /...原创 2019-09-15 21:38:16 · 361 阅读 · 0 评论 -
C++判断大端小端
C/C++大端小端判断https://www.cnblogs.com/zjutzz/p/7231183.html一字节为8位、16进制为4位、一字节可以表示2个16进制数。char为1字节、int为4字节。大端正着存、小端倒着存。说的是变量的高字节、低字节在内存地址中的排放顺序。变量的高字节放到内存的低地址中(变量的低字节放到内存的高地址中)==>大端变量的高字节放到内...转载 2019-09-15 20:07:23 · 865 阅读 · 0 评论 -
C++ 数组内存
原创 2019-09-15 19:32:37 · 552 阅读 · 0 评论 -
while(cin>>n)结束
while(cin>>n) ctrl+z可以结束while (cin >> hn){ if (cin.get() == '\n') { break; }}结束cin得到不定多行的不定长数组。getline得到不定长的一行,将该行拆分成每个数。while得到不定多行。当getline没有得到时,即为结束。int ma...原创 2019-09-07 09:34:23 · 7678 阅读 · 0 评论 -
C++牛客笔记
[define](1)#define是宏定义,它在预编译的时候进行简单地文本替换。(2)#define不做类型检查,它很容易出错。(3)#define仅仅是宏替换,它不会占用内存。(4)当我们用#define定义一个简单函数时,强烈建议使用内联函数替换.例如:牛客网华中第一狠人程德彪#include <iostream>using namespace s...原创 2019-08-07 20:56:53 · 234 阅读 · 0 评论 -
重建二叉树
题目描述输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并返回。前序+中序得到二叉树递归实现:前序第一个数root为根节点,在中序找到root,中序中root左边的为根节点的左子树,右边的为根节点的右子树。递...原创 2019-08-09 11:06:18 · 167 阅读 · 0 评论 -
scanf和printf
c语言中scanf和printf转换说明:%d %i:有符号十进制整数,用%d显示float类型的值,不会转化为int类型;%f:可显示float或double类型的值%a,%A:十六进制表示浮点数%e,%E:指数计数法表示浮点数,12.e24,12.E24。%#o,%o:无符号八进制;前一个表示格式为014,后一个表示...原创 2019-08-01 11:00:23 · 2744 阅读 · 0 评论 -
const用法
const用法大全:https://www.cnblogs.com/lanjianhappy/p/7298427.html修改const int i;https://blog.youkuaiyun.com/weixin_41413441/article/details/80860135#include <iostream>#include <string>u...原创 2019-08-05 12:20:41 · 286 阅读 · 0 评论 -
访问结构体->和.
访问结构体时,普通变量用点. 指针变量用->struct students{ int id; char name[20]; students* next;}stu,*p;stu.idstu.namestu.next(*p).id(*p).name(*p).nextp->idp->namep->next其中,stud...原创 2019-08-01 10:00:56 · 639 阅读 · 0 评论 -
C++:int、double范围
一、基本数据类型的特点,位数,最大值和最小值。1、基本类型:short二进制位数:16 (2字节)最小值:Short.MIN_VALUE=-32768 (-2的15此方)最大值:Short.MAX_VALUE=32767 (2的15次方-1)2、基本类型:int 二进制位数:32(4字节)最小值:Integer.MIN_VALUE= -2147483648 (-2的31次方)最大...转载 2019-07-08 20:30:46 · 28052 阅读 · 3 评论 -
HTML 字符实体
https://www.w3school.com.cn/html/html_entities.aspHTML 中有用的字符实体注释:实体名称对大小写敏感!显示结果 描述 实体名称 实体编号 空格   < 小于号 < < > 大于号...原创 2019-08-03 09:57:27 · 191 阅读 · 0 评论 -
排序若干C++实现
#include <iostream>#include <vector>using namespace std;void InsertSort(vector<int> &A){ for (int i = 1; i < int(A.size()); i++) { if (A[i] < A[i - 1]) { int...原创 2019-07-21 18:38:56 · 168 阅读 · 0 评论 -
二叉树C++实现
#include <iostream>using namespace std;typedef struct BiNode { int data; struct BiNode* lchild; struct BiNode* rchild;}BiNode,*Bitree;void createBitree(Bitree &T){ int ch; cin &...原创 2019-07-21 18:38:17 · 334 阅读 · 0 评论 -
单链表C++实现
#include <iostream>#include <vector>using namespace std;int datacin[5] = { 1,2,3,4,5 };typedef struct LNode { int data; struct LNode* next;}LNode,*LinkList;int InitList(LinkList &...原创 2019-07-21 18:37:28 · 556 阅读 · 0 评论 -
栈C++实现
#include <iostream>using namespace std;typedef struct{ int *base; int *top; int stacksize;}sqstack;int initstack(sqstack &S){ S.base = new int[5]; S.top = S.base; S.stacksize = 5...原创 2019-07-21 18:36:21 · 267 阅读 · 0 评论 -
C++:char、int占多少字节
x86sizeof(char) 1sizeof(char*) 4sizeof(int) 4sizeof(int*) 4sizeof(double) 8sizeof(double*) 4sizeof(float) 4sizeof(float*) 4sizeof(string) 28sizeof(string*) 4x64sizeof(char) 1...原创 2019-08-02 16:31:03 · 16786 阅读 · 0 评论 -
C++ 函数传递 一个例子让你理解c++的指针(传递动态内存)
https://blog.youkuaiyun.com/sinat_35803474/article/details/76686061转载 2019-07-19 20:24:12 · 252 阅读 · 0 评论 -
for(auto &a :b)
C++11新标准。auto推导类型。int arr[10];for(int i=0;i<10;i++){ arr[i]=i;}for(auto &a:arr){ std::cout << a;}输出的结果就是0—9这十个数。for(auto &a : arr)中“auto &a”就是变量名就和上一个for循环中的...转载 2019-03-28 16:20:07 · 8068 阅读 · 1 评论
分享