-
大小: 7KB文件類型: .cpp金幣: 1下載: 0 次發(fā)布日期: 2021-01-09
- 語(yǔ)言: C/C++
- 標(biāo)簽: 數(shù)據(jù)結(jié)構(gòu)??c語(yǔ)言??
資源簡(jiǎn)介
停車場(chǎng)管理系統(tǒng)數(shù)據(jù)結(jié)構(gòu)程序設(shè)計(jì),滿足一般程序設(shè)計(jì)實(shí)踐的要求,棧模擬停車場(chǎng),隊(duì)列模擬車場(chǎng)外的便道,以及汽車“到達(dá)”或“離去”,汽車牌照號(hào)碼及到達(dá)或離去的時(shí)刻,并計(jì)算價(jià)格
代碼片段和文件信息
#include
#include“stdlib.h“
#define TRUE?????????????1
#define FALSE????????????0
#define OK???????????????1
#define ERROR????????????0
#define OVERFLOW?????????-2?
#define STACK_INIT_SIZE ?100
#define STACKINCREMENT???10
#define PRICE????????????0.05 //停車費(fèi)用單價(jià)
#define?MAXSIZE ?????????2 //停車場(chǎng)容量
typedef struct Car {
//結(jié)構(gòu)體:車輛Car
int number;
int inTime;
int outTime;
}Car;
typedef Car User; //用戶自定義類型
typedef int Status;
typedef User SElemType;
//棧部分
typedef struct {
SElemType *base;
SElemType *top;
int stacksize;
}SqStack;
Status?InitStack(SqStack?&S)?{
S.base?=?(SElemType?*?)malloc(STACK_INIT_SIZE?*?sizeof(SElemType));
if(!S.base) exit(OVERFLOW);
S.top?=?S.base;
S.stacksize?=?STACK_INIT_SIZE;
return OK;
}//InitStack
評(píng)論
共有 條評(píng)論