C
文章平均质量分 63
D8
这个作者很懒,什么都没留下…
展开
-
C语言 枚举类型
在实际问题中,有些变量的取值被限定在一个有限的范围内。例如,一个星期内只有七天,一年只有十二个月,一个班每周有六门课程等等。如果把这些量说明为整型,字符型或其它类型显然是不妥当的。为此,C语言提供了一种称为“枚举”的类型。在“枚举”类型的定义中列举出所有可能的取值,被说明为该“枚举”类型的变量取值不能超过定义的范围。应该说明的是,枚举类型是一种基本数据类型,而不是一种构造类型,因为它不能再分解为任转载 2013-07-11 00:42:34 · 486 阅读 · 0 评论 -
控制台版贪吃蛇
#include#include#include#include#include//地图大小#define MAP_SIZE 20//全局屏幕输出缓存区句柄HANDLE g_hOutput;//地图属性struct MapNode_s{enum NodeType_e{NOTHING, SNAKE , WALL, FOOD};NodeType_e原创 2013-10-13 02:07:15 · 504 阅读 · 0 评论 -
红黑树数据结构剖析
FlorianWelcome to:http://www.cnblogs.com/fanzhidongyzby红黑树数据结构剖析红黑树数据结构剖析 红黑树是计算机科学内比较常用的一种数据结构,它使得对数据的搜索,插入和删除操作都能保持在O(lgn)的时间复杂度。然而,相比于一般的数据结构,红黑树的实现的难度有所增加。网络上关于红黑树的实现资料转载 2013-09-28 19:01:28 · 649 阅读 · 0 评论 -
堆排序
#include #include #include templatevoid Sort(A * array, int max_node,bool re){if(re){SortBig2Small(array , max_node);}else{SortSmall2Big(array , max_node);}}templ原创 2013-10-09 13:57:01 · 397 阅读 · 0 评论 -
C语言 超级跳转
#include #include jmp_buf a;int staten;int n = 0;void F(){ staten = setjmp(a); printf("%d, %d\n",++n,staten); getchar(); return;}int main(int argc, char *argv[]){原创 2013-09-16 16:04:35 · 460 阅读 · 0 评论 -
C语言(函数传递可变长度的参数列表)va_arg
#include #include int jf(int num,...){ int num1,num2; va_list argptr; va_start( argptr, num ); num1 = va_arg( argptr, int ); --num; for( ; num > 0; num-- )原创 2013-09-02 17:10:28 · 918 阅读 · 0 评论 -
C mysql
#include #include #include #include // 进行网络编程需要winsock2.h#include #include #include #pragma comment(lib, "libmysql.lib")#pragma comment(lib ,"ws2_32")using namespace std;MYSQL mys原创 2013-08-07 10:55:08 · 444 阅读 · 0 评论 -
二叉树查找树...
#include #include #include #include using namespace std;//R 大 L 小 struct Node{Node* L;Node* R;Node* root;int data;Node(int d=0):data(d),L(),R(){}};class bst{ int n;public原创 2013-07-20 17:24:25 · 373 阅读 · 0 评论 -
二分查找算法
二分查找算法 二分查找算法是在有序数组中用到的较为频繁的一种算法,在未接触二分查找算法时,最通用的一种做法是,对数组进行遍历,跟每个元素进行比较,其时间为O(n).但二分查找算法则更优,因为其查找时间为O(lgn),譬如数组{1, 2, 3, 4, 5, 6, 7, 8, 9},查找元素6,用二分查找的算法执行的话,其顺序为: 1.第一步查找中间元素,即5,由于5转载 2013-07-20 18:59:11 · 495 阅读 · 0 评论 -
二分排序
#include void f(int *a,int len){if(lenreturn ;int i;int t=0,w=len-1;int c[len];for(i=1;i{if(a[i]>a[0]){c[w]=a[i];w--;}else{c[t]=a[i];t++; } }c[w]=a[0];for(i原创 2013-07-20 17:24:43 · 394 阅读 · 0 评论 -
time.h库简单应用
#include #include //CLOCKS_PER_SEC ((clock_t)1000) 表示一秒钟会有多少个时钟计时单元int main(int argc, char *argv[]){clock_t n,m;printf("%ld\n",CLOCKS_PER_SEC); n=clock(); // clock() 程序已经运行过的时间 毫秒为单位 返原创 2013-07-17 14:13:11 · 658 阅读 · 0 评论 -
二叉查找树(二叉排序树)的详细实现
1、序 详细实现了二叉查找树的各种操作:插入结点、构造二叉树、删除结点、查找、 查找最大值、查找最小值、查找指定结点的前驱和后继2、二叉查找树简介 它或者是一棵空树;或者是具有下列性质的二叉树: (1)若左子树不空,则左子树上所有结点的值均小于它的根结点的值; (2)若右子树不空,则右子树上所有结点的值均大于它的根结点的值; (3)左、右子树也分别为二叉排序树转载 2013-07-16 19:33:59 · 412 阅读 · 0 评论 -
函数指针
#include using namespace std;typedef int (*px)(int , int);int p(int a,int b){coutreturn 0; }int a(int(*ax)(int), int x){return ax(x);}int b(int x){return x;}/*i原创 2013-07-15 19:35:25 · 333 阅读 · 0 评论 -
c语言 union 联合体
c语言 union 意思?英文直译就是联合体,就是一个多个变量的结构同时使用一块内存区域,区域的取值大小为该结构中长度最大的变量的值。union myunion{char charvar;int intvar;float floatvar;}int main(){union myunion uni;printf("请输入一个字符");scanf("%c"原创 2013-07-11 00:46:53 · 588 阅读 · 0 评论 -
简单的事件机制
#include#include#define ObjDef(class_name) \s_ClassName = #class_name; \v_id = this;class CObject;class CEvent;class CSendEvent;class CEventsManage;class CObject{public:原创 2014-11-16 00:19:16 · 378 阅读 · 0 评论