随笔分类 - C++
摘要:1 #include <iostream> 2 using namespace std; 3 4 int num[4] = { 2, 2, 4, 6 }; 5 int f() 6 { 7 bool state[5][6]; //在linux中注意用memset(state,false,sizeof(
阅读全文
摘要:https://blog.csdn.net/qq_37059483/article/details/81662359
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 4 int arrayInit(int size, int **outbuf) //一维数组的初始化 5 { 6 int *a = NULL; 7 a=(int*)malloc(sizeof(int)*(si
阅读全文
摘要:1 template <typename Type> //关键字class 与typename的区别,,前者可能是类,后者是一个类型 2 Type min(Type a, Type b) 3 { 4 return a < b ? a : b; 5 } 6 7 template <class Type
阅读全文
摘要:一、继承 (1)继承的概念 在了解继承之前首先要知道[类]-class,而继承则是描述类与类之间关系的,通常代表了is a关系。例如,哺乳动物是动物,狗是哺乳动物,因此,狗是动物,等等。 当创建一个类时,您不需要重新编写新的数据成员和成员函数,只需指定新建的类继承了一个已有的类的成员即可。这个已有的
阅读全文
摘要:1.strcpy:字符串复制函数 strcpy(A,B)表示用B覆盖A。(A字符长度要大于等于B字符长度加1,1为null结束符长度) 2.strncpy strncpy(A,B,n)表示把B中的n个字符复制到A当中(n为正整数)
阅读全文

浙公网安备 33010602011771号