停车场管理系统及课程设计报告(编辑修改稿)内容摘要:

选择 1|2|3:)。 printf(\n\n\t\t\t1. 车场 \n\n\t\t\t2. 便道 \n\n\t\t\t3. 返回\n\n\t\t\t)。 while(1) { scanf(%d,amp。 tag)。 if(tag=1||tag=3) break。 else printf(\n\t\t\t请选择 1|2|3:)。 } switch(tag) { case 1:List1(amp。 S)。 break。 /*列表显示车场信息 */ case 2:List2(amp。 W)。 break。 /*列表显示便道信息 */ case 3:flag=0。 break。 default: break。 } } } 设计体会 通过这一周的课程设计, 加深了我对《数据结构》这门课程所学内容 的进一步的理解与掌握;同时,通过对停车场管理系统的开发,使得我将计算机课程所学知识与实际问题很好数据结构课程设计 .停车场管理系统 第 19 页 共 97 页 地相联接在了一起。 在这次课程设计中,不仅培养了我开发一个中小型程序的能力,而且也培养了我的团队合作能力。 在这次对停车场管理系统的开发过程中,我们小组成员互相合作,互相帮助,其中有程序功能成功实现时的欣喜,也有遇到问题、解决问题时的执着以及迷茫。 在这次课程设计中,使得我很好地了解了在开发程序过程中合作的重要性。 在这周课程设计中,我们小组所开发的停车场管理系统,基本上可以完成每一项功能。 汽车进入停车场的信息、离开停 车场的信息以及通道上的信息都可以在程序上一一实现。 但是,该程序也有不足的地方。 主要表现在车辆的车牌号上,现实中的车牌号是一串字符,可是,在这个程序中,为了简便起见,我们就车牌号定义为了整型,这个与现实是有些不符的。 还有一个可以改进的地方就是记录车辆进入停车场以及离开停车场的时间,应该精确到小时以及分钟的,可是在程序中,为了简便起见,我们只是设置成了一个时刻,所以,在这方面还是有待改进的。 改进的程序中,还应该增加时间的判断功能,即停车场内有可能有车辆停放的时间超过一天。 还有一个很重要的问题,对于停车场内可以 停放的最多车辆数,为了测试数据的方便,我在程序中,定为了 2,在实际使用中,可以改变程度开头的宏定义以增加停车场的容量。 总之,在这周的课程设计中,我以及我们这组的收获还是挺大的,不仅对于专业课有了更好的认识,而且在合作的过程中更加了解了团队精神的重要性。 主 要 参 考 资 料 [1] 谭浩强 . C 语言程序设计(第三版)[M] . 北京:清华大学出版社, 2020 [2] 廖雷、罗代忠 . C 语言程序设计基础实验教程[M] . 北京:高等教育出版社, 2020 [3] 谭浩强 . C 程序设计解题与上机指导 (第三版 ) [M] . 北京:清华大 学出版社, 2020 [4] 廖雷等 . C 语言程序设计基础[M] . 北京:高等教育出版社, 2020 [5] 谭浩强,张基温,唐永炎 . C 语言程序设计教程 . 北京 : 高等教育出版社, 2020 可供选择源程序代码: 一: /******************************* 停 车 场 管 理 器*************************************/ 数据结构课程设计 .停车场管理系统 第 20 页 共 97 页 include include include include /********************************************************************************/ define MAXSTACKSIZE 2 /*车库容量 */ define price /*每车每分钟费用 */ typedef struct time{ int hour。 int min。 }Time。 /*时间结点 */ typedef struct { char num[10]。 Time reach。 Time leave。 }CarNode。 /*车辆信息结点 */ typedef struct { CarNode *base。 CarNode *top。 int stacksize。 }SqStackCar。 /*模拟车站 */ 数据结构课程设计 .停车场管理系统 第 21 页 共 97 页 typedef struct car{ CarNode *data。 struct car *next。 }QueueNode。 typedef struct { QueueNode *front。 QueueNode *rear。 }LinkQueueCar。 /*模拟通道 */ int QueueEmpty(LinkQueueCar Q) /*便道判空函数 */ { if(==) return 1。 else return 0。 } /********************************************************************************/ void InitStack(SqStackCar *s) /*初始化栈 */ { sbase=(CarNode *)malloc(MAXSTACKSIZE*sizeof(CarNode))。 if(!sbase) exit(0)。 /*分配失败 */ stop=sbase。 sstacksize=MAXSTACKSIZE。 数据结构课程设计 .停车场管理系统 第 22 页 共 97 页 } int Push(SqStackCar *s,CarNode *e) /*进站函数 */ { if(stopsbase=sstacksize) return 0。 else *stop++=*e。 return 1。 } int Pop(SqStackCar *s,CarNode *e) /*出站函数 */ { if(stop==sbase) return 0。 *e=*stop。 return 1。 } int StackEmpty(SqStackCar s) /*判空函数 */ { if(==) return 1。 else return 0。 } int InitQueue(LinkQueueCar *Q) /*初始化便道 */ { Qfront=Qrear=(QueueNode *)malloc(sizeof(QueueNode))。 if(!Qfront) exit(0)。 数据结构课程设计 .停车场管理系统 第 23 页 共 97 页 Qfrontnext=NULL。 return 1。 } /**************************************************************/ int EnQueue(LinkQueueCar *Q,CarNode *e) /*便道插入函数 */ { QueueNode *p。 p=(QueueNode *)malloc(sizeof(QueueNode))。 if(!p) exit(0)。 pdata=e。 pnext=NULL。 Qrearnext=p。 Qrear=p。 return 1。 } int DeQueue(LinkQueueCar *Q,CarNode *e) /*便道删除函数 */ { QueueNode *p。 if(Qfront==Qrear) return 0。 p=Qfrontnext。 e=pdata。 数据结构课程设计 .停车场管理系统 第 24 页 共 97 页 Qfrontnext=pnext。 if(Qrear==p) Qrear=Qfront。 free(p)。 return 1。 } /********************************************************************************/ int Arrive(SqStackCar *In,LinkQueueCar *Wait) /*车辆到达函数*/ { CarNode *i。 QueueNode *w。 i=(CarNode *)malloc(sizeof(CarNode))。 flushall()。 printf(Input the car number:)。 gets(inum)。 if(IntopInbaseMAXSTACKSIZE) /*车场未满,车辆进栈*/ { printf(\nThe time the car arrive(00:00): )。 scanf(%d:%d,amp。 i,amp。 i)。 Push(In,i)。 数据结构课程设计 .停车场管理系统 第 25 页 共 97 页 printf(\nCar in success!!)。 sleep(1)。 return 1。 } else /*停车场已满,车进便道 */ { w=(QueueNode *)malloc(sizeof(QueueNode))。 wdata=i。 wnext=NULL。 Waitrearnext=w。 Waitrear=w。 printf(The PART is full,car must wait in the road!)。 sleep(1)。 return 1。 } return 0。 } /********************************************************************************/ int Departure(SqStackCar *In,SqStackCar *temp,LinkQueueCar *Wait) /*车辆离开函数 */ { 数据结构课程设计 .停车场管理系统 第 26 页 共 97 页 int flag=0,a1,a2,b1,b2, money。 CarNode *p,*t。 QueueNode *q。 p=(CarNode *)malloc(sizeof(CarNode))。 flushall()。 printf(Input the out car number: )。 gets(pnum)。 while(!StackEmpty(*In)) { t=(CarNode *)malloc(sizeof(CarNode))。 Pop(In,t)。 if(strcmp(pnum,tnum)==0) /*比较车场中有无这辆车,有即出站 */ { printf(Input the time the car out(00:00):)。 scanf(%d:%d,amp。 p,amp。 p)。 printf(The )。 printf(%s,pnum)。 printf( Car out the part!)。 a1= p。 a2= t。 b1= p。 数据结构课程设计 .停车场管理系统 第 27 页 共 97 页 b2= t。 money = ((a1a2+24)%24*60+(b1b2+60)%60)*price。 /*计算车辆需要的费用 */ printf(\nThe time the car arrive: %d:%d,t,t)。 printf(\nThe time the car leave: %d:%d,p,p)。 printf(\nNeed: %d yuan,money)。 flag=1。 getch()。 free(t)。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。