随笔分类 -  C基础知识

摘要:#include #include //必须包含的头文件using namespace std;int main(){int point[10] = {1,3,7,7,9};int tmp = upper_bound(point, point + 5, 7) - point;//按从小到大,7最多能... 阅读全文
posted @ 2015-04-05 22:03 PastLIFE 阅读(122) 评论(0) 推荐(0)
摘要:比如 int g(int x) { return x + x; } int f() { return g(); } 这样f会调用g,然后g返回x + x给f,然后f继续把那个值返回给调用者。 如果g是inline的话。f会被直接编译成。 int f() { return x + x; } 相当于把g... 阅读全文
posted @ 2015-04-05 15:51 PastLIFE 阅读(266) 评论(0) 推荐(0)
摘要:主要是对于动态数组vector的用法1 基本操作(1)头文件#include.(2)创建vector对象,vector vec;(3)尾部插入数字:vec.push_back(a);(4)使用下标访问元素,cout::iterator it;for(it=vec.begin();it!=vec.en... 阅读全文
posted @ 2015-04-05 15:20 PastLIFE 阅读(115) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 //定义比较结构 8 struct cmp1 9 { 10 bool operator ()(int &a,int &b) 11... 阅读全文
posted @ 2015-04-04 19:02 PastLIFE 阅读(135) 评论(0) 推荐(0)
摘要:qsort():原型:_CRTIMP void __cdeclqsort(void*, size_t, size_t,int (*)(const void*, const void*));解释: qsort ( 数组名 ,元素个数,元素占用的空间(sizeof),比较函数)比较函数是一个自己写的函数... 阅读全文
posted @ 2015-04-01 18:16 PastLIFE 阅读(158) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;char a[210];int main(){ while(scanf("%s",a)!=EOF) { int len = strlen(a); sort(... 阅读全文
posted @ 2015-03-20 21:02 PastLIFE 阅读(368) 评论(0) 推荐(0)
摘要:转载http://blog.csdn.net/sjf0115/article/details/8579935在ZOJ 1085Alien Security中 阅读全文
posted @ 2015-03-12 12:45 PastLIFE 阅读(126) 评论(0) 推荐(0)
摘要:1基本概念 memset是linux环境下一个直接操作内存空间的C语言函数2主要特点2.1函数介绍 void *memset(void *s, int ch, size_t n); 函数解释:将s中前n个字节替换为ch并返回s; memset:作用是在一段内存块中填充某个给定的值,它是对较大... 阅读全文
posted @ 2014-07-16 19:54 PastLIFE 阅读(305) 评论(1) 推荐(0)