摘要: 1、共用体 union 可以存储不同的数据类型,但只能同时存储其中的一种类型。 共用体每次只能存储一个值。 共用体的长度是其最大的成员的长度。 2、枚举 enum创建符号常量, enum spectrum {red ,yellow,blue=8,white};//0,1,8,9 枚举量默认从0开始, 阅读全文
posted @ 2019-09-06 15:27 Tomorrow1126 阅读(106) 评论(0) 推荐(0)
摘要: 堆栈 #include<iostream> #define maxsize 1000 using namespace std; typedef struct SNode*Stack;//栈的顺序存储结构 struct SNode { int data[maxsize]; int top;//栈顶元素 }; void Push(Stack Ptrs, int item)//入栈 { if (Ptrs 阅读全文
posted @ 2019-09-06 10:23 Tomorrow1126 阅读(127) 评论(0) 推荐(0)
摘要: 线性表的数组实现 #include const int max = 1000; using namespace std; typedef struct LNode *List; struct LNode { int Data[max]; int Last; }; List MakeEmpty() { List PtrL; PtrL = (List)malloc(... 阅读全文
posted @ 2019-09-06 10:22 Tomorrow1126 阅读(154) 评论(0) 推荐(0)
摘要: 一种很简单的算法int MaxSub(int A[], int N) { int ThisSum, MaxSum; int i; ThisSum = 0; MaxSum = 0; for (int i = 0; i MaxSum) { MaxSum = ThisSum; } else... 阅读全文
posted @ 2019-09-06 10:21 Tomorrow1126 阅读(104) 评论(0) 推荐(0)