c语言程序--火车站售票系统程序

c语言程序--火车站售票系统程序

ID:34812526

大小:133.00 KB

页数:12页

时间:2019-03-11

c语言程序--火车站售票系统程序_第1页
c语言程序--火车站售票系统程序_第2页
c语言程序--火车站售票系统程序_第3页
c语言程序--火车站售票系统程序_第4页
c语言程序--火车站售票系统程序_第5页
资源描述:

《c语言程序--火车站售票系统程序》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、实用标准火车站售票查询系统:#include#include#include#includeintshoudsave=0;intcount1=0,count2=0,mark=0,mark1=0;/*定义存储火车信息的结构体*/structtrain{charnum[10];/*列车号*/charcity[10];/*目的城市*/chartakeoffTime[10];/*发车时间*/charreceiveTime[10];/*到达时间*/intprice;

2、/*票价*/intbookNum;/*票数*/};/*订票人的信息*/structman{charnum[10];/*ID*/charname[10];/*姓名*/intbookNum;/*需求的票数*/};/*定义火车信息链表的结点结构*/typedefstructnode{structtraindata;structnode*next;}Node,*Link;/*定义订票人链表的结点结构*/typedefstructpeople{structmandata;structpeople*next;}bookMan,*bookMan

3、Link;/*初始界面*/voidprintInterface(){puts("********************************************************");puts("*Welcometousethesystemofbookingtickets*");puts("********************************************************");文档实用标准puts("*Youcanchoosetheoperation:*");puts("*1:Inser

4、tatraininformation*");puts("*2:Inquireatraininformation*");puts("*3:Bookatrainticket*");puts("*4:Updatethetraininformation*");puts("*5:Advicetoyouaboutthetrain*");puts("*6:saveinformationtofile*");puts("*7:quitthesystem*");puts("***************************************

5、*****************");}/*添加一个火车信息*/voidInsertTraininfo(Linklinkhead){structnode*p,*r,*s;charnum[10];r=linkhead;s=linkhead->next;while(r->next!=NULL)r=r->next;while(1){printf("pleaseinputthenumberofthetrain(0-return)");scanf("%s",num);if(strcmp(num,"0")==0)break;/*判断是否已经

6、存在*/while(s){if(strcmp(s->data.num,num)==0){printf("thetrain'%s'hasbeenborn!",num);return;}s=s->next;}p=(structnode*)malloc(sizeof(structnode));strcpy(p->data.num,num);printf("Inputthecitywherethetrainwillreach:");scanf("%s",p->data.city);printf("Inputthetimewhichth

7、etraintakeoff:");scanf("%s",p->data.takeoffTime);printf("Inputthetimewhichthetrainreceive:");scanf("%s",&p->data.receiveTime);printf("Inputthepriceofticket:");文档实用标准scanf("%d",&p->data.price);printf("Inputthenumberofbookedtickets:");scanf("%d",&p->data.bookNum);p->nex

8、t=NULL;r->next=p;r=p;shoudsave=1;}}/*打印火车票信息*/voidprintTrainInfo(structnode*p){puts("Thefollowingistherecordyouwant:");pri

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。