码迷,mamicode.com
首页 >  
搜索关键字:struct enum    ( 22969个结果
cocos2dx 获取当前时间
之前使用过cocos2d-x获取系统时间,毫秒级的 [cpp] view plaincopy long getCurrentTime()      {           struct timeval tv;           gettimeofday(&tv,NULL);           return tv.tv_sec * 10...
分类:其他好文   时间:2014-05-26 05:37:49    阅读次数:358
c++枚举转换为字符串
?? enum EM_DEMO {  EM_INDEX1 = 1,  EM_INDEX2  = 2,  EM_INDEX3  = 3,  EM_INDEX4  = 4 } //多字节 #define _TXT__(x) #x #define EMTOSTR(EM) _TXT__(EM) //多字节或 unicode #define _TXT__(x)...
分类:编程语言   时间:2014-05-26 05:33:39    阅读次数:849
层次遍历二叉树
按先序序列输入字符序列(其中逗号表示空节点),输出该二叉树的层次遍历序列。 #include #define END ','//表示空节点 using namespace std; typedef char Elem_Type; typedef struct BiTree { Elem_Type data; struct BiTree *Lchild; stru...
分类:其他好文   时间:2014-05-26 04:53:07    阅读次数:261
Linux-0.12内核sleep_on函数分析
sleep_on用于进程休眠,原型如下: void sleep_on(struct task_struct **p) 当进程访问某个互斥资源时,如果资源被另外进程占用,当前进程就需要休眠。 假设资源的结构如下: struct res { .... struct task_struct *wait; } 其实我们参考下文件系统的i节点就会发现,i节点也是一种资源,它的结构体中就有一...
分类:系统相关   时间:2014-05-26 04:28:02    阅读次数:439
C语言 - 结构体(struct)的位字段(:) 详解
结构体(struct)的位字段(:) 详解 本文地址: http://blog.csdn.net/caroline_wendy/article/details/26722511 结构体(struct)可以使用位字段(:), 节省空间, 如以下代码,  结构体a中的, 第一个变量x占用1个字符, y占用2个字符, z占用33个字符(越界); 但是sizeof()会自动补齐, 如x+y一共占用4个字节, z占用8个字节, 所以...
分类:编程语言   时间:2014-05-26 04:12:18    阅读次数:514
poj 2985 The k-th Largest Group 求第K大数 Treap, Binary Index Tree, Segment Tree
题目链接:点击打开链接 题意:有两种操作,合并集合,查询第K大集合的元素个数。(总操作次数为2*10^5) Treap模板(静态数组) #include #include #include #include #include const int maxNode = 500000 + 100; const int inf = 0x3f3f3f3f; struct Tr...
分类:其他好文   时间:2014-05-24 23:18:09    阅读次数:522
【练习题】编写打印出一个单链表的所有元素的程序【链表】
只是实现了链表ADT的部分功能。 /*---编写打印出一个单链表的所有元素的程序---*/ #include #include struct Node{ int val; struct Node *next; }; Node *findEnd(Node *list){ while(list->next) list = list->next; return list; } v...
分类:其他好文   时间:2014-05-24 22:30:37    阅读次数:232
【练习】P62
/*---分别对单链表和双链表,只使用指针来交换两个相邻的元素。---*/ /*-单链表版本-*/ #include #include struct Node{ int val; struct Node *next; }; Node *findEnd(Node *list){ while(list->next) list = list->next; return ...
分类:其他好文   时间:2014-05-24 19:41:49    阅读次数:253
C经典之14-双向链表存储1-10---ShinePans
#include #include #include //system(); 这个指令需要用到此头文件 #include //toupper要用到 #include //在内存管理时用到的头文件 void main() { int i; struct ListEntry{ int number; //数据域 struct ListEntry *next; //指向 下...
分类:其他好文   时间:2014-05-24 18:15:27    阅读次数:258
【练习】P62页3.2题
/*---给你一个链表L和另一个链表P,它们包含以升序排列的整数。操作PrintLots(L,P) 将打印L中那些由P所指定位置上的元素。---*/ #include #include struct Node{ int val; struct Node *next; }; Node *findEnd(Node *list){ while(list->next) list = l...
分类:其他好文   时间:2014-05-24 14:27:42    阅读次数:224
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!