摘要: http://blog.csdn.net/nupt123456789/article/details/8120397 阅读全文
posted @ 2017-07-23 11:57 cheshulin 阅读(107) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/nupt123456789/article/details/8120397 阅读全文
posted @ 2017-07-23 11:56 cheshulin 阅读(113) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; typedef struct { char *name; int stuid; int age; }Student; /**************************/ bool cmp(const Student &stua,const Student &stub) { return stua.age>stub.age... 阅读全文
posted @ 2017-07-22 22:04 cheshulin 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 一,概述 仿函数(functor),就是使一个类的使用看上去象一个函数。其实现就是类中实现一个operator(),这个类就有了类似函数的行为,就是一个仿函数类了。 有些功能的的代码,会在不同的成员函数中用到,想复用这些代码。 1)公共的函数,可以,这是一个解决方法,不过函数用到的一些变量,就可能成 阅读全文
posted @ 2017-07-22 20:57 cheshulin 阅读(323) 评论(0) 推荐(0) 编辑
摘要: #include #include//为了使用exit() int swapInt32(int value) { return ((value & 0x000000FF) > 8) | ((value & 0xFF000000) >> 24) ; } int main() { int a,b; FILE *outFp, *inFp; inFp... 阅读全文
posted @ 2017-06-24 14:43 cheshulin 阅读(600) 评论(0) 推荐(0) 编辑
摘要: http://c.biancheng.net/cpp/html/476.html 阅读全文
posted @ 2017-06-18 15:01 cheshulin 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 用二级指针作为函数参数,有两种典型情况:1、需要传递一级指针的数组时:例如标准C的main函数:int main(int argc, char*[] argv),数组最高维可以退化,char*[] argv等价于char** argv。这里argv代表命令行参数数组。2、需要对传入的一级指针进行修改 阅读全文
posted @ 2017-06-18 11:44 cheshulin 阅读(2280) 评论(0) 推荐(0) 编辑
摘要: #include #include #include "string.h" struct student { int age; char *name;//char name[10]; }; /* 指针传递,省去拷贝时间 */ void stuprint(student *pst) { printf("形参地址%p\r\n",pst); printf("pst... 阅读全文
posted @ 2017-06-18 11:07 cheshulin 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include "string.h" 4 /* 数值传递 */ 5 void test1(int **ppint) 6 { 7 int *pint=(int *)malloc(sizeof(int)*100);//为什么在这里会报错 8 ppint=&pint; 9 10 } 11 /* 指针传递 */ ... 阅读全文
posted @ 2017-06-18 10:23 cheshulin 阅读(241) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include "listEx.h" using namespace std; typedef struct { char name[100]; int age; char address[100]; }STUDENT; typedef list STUDENTLIST; class EventIsIn1... 阅读全文
posted @ 2017-02-28 00:29 cheshulin 阅读(125) 评论(0) 推荐(0) 编辑