C语言停车场管理系统源代码.doc

上传人:cn****1 文档编号:550859800 上传时间:2024-02-29 格式:DOC 页数:8 大小:53.51KB
返回 下载 相关 举报
C语言停车场管理系统源代码.doc_第1页
第1页 / 共8页
C语言停车场管理系统源代码.doc_第2页
第2页 / 共8页
C语言停车场管理系统源代码.doc_第3页
第3页 / 共8页
C语言停车场管理系统源代码.doc_第4页
第4页 / 共8页
C语言停车场管理系统源代码.doc_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《C语言停车场管理系统源代码.doc》由会员分享,可在线阅读,更多相关《C语言停车场管理系统源代码.doc(8页珍藏版)》请在金锄头文库上搜索。

1、#include#include#define stacksize 2 /车站/容量/typedef struct Snode int number; float int_time2; float bian_time2;record;typedef struct record *base; record *top; int size;Stack;/typedef struct Qnode int number; float int_time2; struct Qnode *next;Qnode,*Queue;typedef struct Queue front; Queue rear;Link

2、queue;void xunhuan(Stack L,Linkqueue Q);void jixu(Stack L,Linkqueue Q);/void InitStack(Stack &L) /堆栈操作 L.base=(record*)malloc(sizeof(Snode)*stacksize); if(!L.base) exit(0); L.top=L.base; L.size=stacksize;/void input(Stack &L,record h) *L.top+=h; /Snode output(Stack &L,record &e) e=*-L.top; return e;

3、 int Stackman(Stack L) if(L.top-L.base=L.size) return 0; else return 1;int StackEmpty(Stack L) if(L.base=L.top) return 0; else return 1;/void Initque(Linkqueue &Q) /队列操作 Q.front=Q.rear=(Queue)malloc(sizeof(Qnode); if(!Q.front) exit(0); Q.front-next=NULL;/void enqueue(Linkqueue &Q,int number,float ti

4、me) Queue q; printf(停车场已满,请将车辆停入便道!n); q=(Queue)malloc(sizeof(Qnode); q-int_time0=time0; q-int_time1=time1; q-number=number; q-next=NULL; Q.rear-next=q; Q.rear=q; /void outqueue(Linkqueue &Q,Queue &e) /此处有点问题? / Qnode *q; /q=(Queue)malloc(sizeof(Qnode); e=Q.front-next; / Q.front-next=q-next;/delete

5、q; Q.front-next=Q.front-next-next; if(Q.rear=e) Q.front=Q.rear; / Q.front=NULL; int QEmpty(Linkqueue Q) if(Q.rear=Q.front) return 0; else return 1;/ /停车场管理操作/void jixu(Stack L,Linkqueue Q)int n; fflush(stdin); scanf(%d,&n);switch(n)case 1:printf(nn);xunhuan(L,Q); break;case 2:printf(*退出管理系统*n); brea

6、k;default:printf(n输入错误,请重新输入: );jixu(L,Q);break;void jiaofei(float time,float time1,float time2) /缴费操作 float data1,data2;double money;if(time20!=0&time21!=0) data2=(time10-time20-1)*60+60-time21+time11;elsedata2=0;data1=(time0-time10-1)*60+60-time11+time1;/printf(进入车场时间%f,退出车场时间%fn,time11,time1);pri

7、ntf(你的停车时间为%lf小时 ,在便道停留时间%f小时n,data1/60,data2/60); money=data1/60*5.0+data2/60*2.0; printf(请交纳%lf元n,money); /* if(data160.0&data1120.0)printf(请交纳20元。);*/void leave(Stack &L,Linkqueue &Q,int number,float time) /汽车离开操作Stack S;InitStack(S);float time12,time22; record e,e1;Queue q; e1=output(L,e); while

8、(e.number!=number) input(S,e1); e1=output(L,e); time10=e.int_time0; /入车站时间time11=e.int_time1;time20=e.bian_time0; /入便道时间time21=e.bian_time1; jiaofei(time,time1,time2); / while(StackEmpty(S) input(L,output(S,e1); while(QEmpty(Q)&Stackman(L) outqueue(Q,q); /printf(nn请输入汽车从便道进入停车场的时间,输入格式为(时 空格 分):); e

9、.bian_time0=q-int_time0; e.bian_time1=q-int_time1; /scanf(%f %f,&time20,&time21); e.int_time0=time0; e.int_time1=time1; e.number=q-number; printf(n汽车从便道退出进入停车场); printf(n请将%d号车停在%d号位置!n,e.number,L.top-L.base+1); input(L,e); /void xunhuan(Stack L,Linkqueue Q) /选择操作及循环/Queue q; char ch; int number; float time2,time22; fflush(stdin); printf(nA:进入停车场 D:退出停车场 E:退出管理系统n); pri

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号