2012年10月16日
摘要: #include using namespace std;//常量值定义#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define OVERFLOW -1#define UNDERFLOW -2#define LIST_INIT_SIZE 100#define LISTINCREMENT 10//函数返回值类型定义typedef int Status;//数据元素类型定义typedef int ElemType;//顺序表结构定义typedef struct{ ElemType *elem; int length; int l 阅读全文
posted @ 2012-10-16 10:18 Eternal Code 阅读(238) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include<stdlib.h>#define LIST_INIT_SIZE 100#define LISTINCREMENT 10//函数返回值类型定义typedef enum { ERROR=0, OK=1,TRUE=1, FALSE = 0, OVERFLOW=-1, UNDERFLOW=-2 } Status;//数据元素类型定义typedef int ElemType;typedef struct{ElemType *base; //栈的存储空间的基地址,即栈底指针ElemType *top; //栈顶指针int max 阅读全文
posted @ 2012-10-16 10:17 Eternal Code 阅读(286) 评论(0) 推荐(0) 编辑
摘要: #include#includetypedef struct{int a;}ElemType;typedef enum { ERROR, OK } Status;typedef struct SNode{ElemType data;struct SNode *prior; //prior将指向其前一次入栈的元素}SNode, *SLink;Status InitStack( SLink &top )//构造一个空栈S, top 为栈顶,它唯一地确定一个栈。空栈时为NULL。{top = NULL;return OK;}//InitStackint StackEmpty( SLink * 阅读全文
posted @ 2012-10-16 10:13 Eternal Code 阅读(226) 评论(0) 推荐(0) 编辑