全文预览

电梯模拟系统

上传者:qnrdwb |  格式:doc  |  页数:20 |  大小:135KB

文档介绍
entInfo(*p,New);?returnOK;}StatusDestoryClient(Client*&p){?deletep;?p=NULL;?returnOK;}StatusGoAbove(Clientconst&e){?if(e.Outfloor>e.Infloor)returnTRUE;?elsereturnFALSE;}StatusCInfloor(Clientconst&e){?returne.Infloor;}StatusCInTime(Clientconst&e){?returne.InTime;}StatusCOutfloor(Clientconst&e){?returne.Outfloor;}#define?STACK_INIT_SIZE?10?//存储空间初始分配量#define?STACKINCREMENT?5?//存储空间分配增量//乘客栈typedef?Client?*SElemType;?typedefstruct{?SElemType?*base; SElemType?*top; int stacksize;?}ClientStack;StatusInitStack(ClientStack&S){?S.base=(SElemType*)malloc(STACK_INIT_SIZE*sizeof(SElemType));?if(!S.base)returnOVERFLOW;?S.top=S.base;?S.stacksize=STACK_INIT_SIZE;?returnOK;}StatusDestroyStack(ClientStack&S){?SElemType?*p;?if(S.base)?{ for(p=S.base;p<S.top;p++) DestoryClient(*p); free(S.base);?}?returnOK;

收藏

分享

举报
下载此文档