C语言-车票管理系统源程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#includestdio.h#includetime.h/*时间库函数*/#includestdlib.h/*调用系统函数*/#includestring.h/*串操作及内存操作函数*/#includeconio.h#includemath.h#defineN80/*宏定义多条记录*/voidmaipiao(ints,intt);/*函数定义*/floattimes(intk);inthour(intk){switch(k){case1:return07;break;case2:return10;break;case3:return13;break;case4:return16;break;case5:return19;break;case6:return21;break;/*d到闽清一天的发车时间小时段*/case7:return07;break;case8:return11;break;case9:return15;break;case10:return19;break;case11:return23;break;/*d到长乐一天的发车时间小时段*/case12:return07;break;case13:return11;break;case14:return15;break;case15:return19;break;case16:return23;break;/*d到连江一天的发车时间小时段*/case17:return07;break;case18:return11;break;case19:return16;break;case20:return20;break;/*d到永泰一天的发车时间小时段*/case21:return07;break;case22:return12;break;case23:return17;break;case24:return22;break;/*d到福清一天的发车时间小时段*/case25:return07;break;case26:return14;break;case27:return19;break;case28:return22;break;/*d到罗源一天的发车时间小时段*/}}/*开车时间段*/intminute(intk){switch(k){case1:return00;break;case2:return00;break;case3:return00;break;case4:return00;break;case5:return00;break;case6:return00;break;/*d到闽清一天的发车时间分钟段*/case7:return00;break;case8:return00;break;case9:return00;break;case10:return00;break;case11:return00;break;/*d到长乐一天的发车时间分钟段*/case12:return00;break;case13:return00;break;case14:return00;break;case15:return00;break;case16:return00;break;/*d到连江一天的发车时间分钟段*/case17:return00;break;case18:return30;break;case19:return00;break;case20:return30;break;/*d到永泰一天的发车时间分钟段*/case21:return00;break;case22:return30;break;case23:return00;break;case24:return30;break;/*d到福清一天的发车时间分钟段*/case25:return30;break;case26:return00;break;case27:return30;break;case28:return30;break;/*d到罗源一天的发车时间分钟段*/}}/*开车时间段*/voidwap(intk){switch(k){case1:printf(闽清);break;case2:printf(长乐);break;case3:printf(连江);break;case4:printf(永泰);break;case5:printf(福清);break;case6:printf(罗源);break;}}/*输入终点站的函数*/intshijian(){structtm*ptr;time_tlt;lt=time(NULL);ptr=gmtime(<);printf(ctime(<));return0;}/*输出当前时间的函数*/floattimes(intk){floatt;if(k==1)t=1.5;if(k==2)t=3.0;if(k==3||k==4)t=4.0;if(k==5||k==6)t=4.5;returnt;}/*输入行车时间的函数*/intnumber(intk){intf;if(k==1||k==2)f=30;if(k==3||k==4)f=40;if(k==5||k==6)f=45;returnf;}/*输入最大载客量的函数*/intnownumber(intk,inti){intn=0;charfilename[10];switch(i){case1:strcpy(filename,qiu1.txt);break;case2:strcpy(filename,qiu2.txt);break;case3:strcpy(filename,qiu3.txt);break;case4:strcpy(filename,qiu4.txt);break;case5:strcpy(filename,qiu5.txt);break;case6:strcpy(filename,qiu6.txt);break;case7:strcpy(filename,qiu7.txt);break;case8:strcpy(filename,qiu8.txt);break;case9:strcpy(filename,qiu9.txt);break;case10:strcpy(filename,qiu10.txt);break;case11:strcpy(filename,qiu11.txt);break;case12:strcpy(filename,qiu12.txt);break;case13:strcpy(filename,qiu13.txt);break;case14:strcpy(filename,qiu14.txt);break;case15:strcpy(filename,qiu15.txt);break;case16:strcpy(filename,qiu16.txt);break;case17:strcpy(filename,qiu17.txt);break;case18:strcpy(filename,qiu18.txt);break;case19:strcpy(filename,qiu19.txt);break;case20:strcpy(filename,qiu20.txt);break;case21:strcpy(filename,qiu21.txt);break;case22:strcpy(filename,qiu22.txt);break;case23:strcpy(filename,qiu23.txt);break;case24:strcpy(filename,qiu24.txt);break;case25:strcpy(filename,qiu25.txt);break;case26:strcpy(filename,qiu26.txt);break;case27:strcpy(filename,qiu27.txt);break;case28:strcpy(filename,qiu28.txt);break;case29:strcpy(filename,qiu29.txt);break;}FILE*fp;if((fp=fopen(filename,rt+))==NULL){printf(cannotopenfile,strikeanykeyexit!);exit(1);}fscanf(fp,%d,&n);n=n+k;rewind(fp);fprintf(fp,%d,n);//将输入数组里面的数据写到文本里fclose(fp);returnn;}/*现在已定票人数*/inttangci(intk){intx;switch(k){case1:x=6;break;case2:x=5;break;case3:x=5;break;case4:x=4;break;case5:x=4;break;case6:x=4;break;default:x=0;break;}returnx;}/*确定每个地方一天行车趟次的函数*/voidjiemian(){printf(********************************************************************************\n);printf(******************************欢迎来到车票查询系统******************************);printf(\n);printf(|★★★a:进入班次一览★★★|\n);printf(|★★★b:进入查询班次★★★|\n);printf(|★★★c:进入终点站查询★★★|\n);printf(|★★★d:售票★★★|\n);printf(|★★★e:退票★★★|\n);printf(|★★★f:增加班次★★★|\n);printf(********************************************************************************\n);printf(\n请选择(a-e):☆☆☆);}/*界面函数*/voidbanci(ints,intt){system(cls);/*清屏*/inti,flag=1,m,k=1,o=0;/*定义一些要用的数据*/printf(车票管理系统);printf(\n);printf(班次发车时间起点站终点站行车时间额定数量已订票人数状态);printf(\n);for(i=1;i=N;i++){if(flag){m=i+tangci(k)-1;flag=0;}/*计算同一个终点站的班次范围*/if(i=10)printf(%d,i);elseprintf(%d,i);if(hour(i)=10)printf(%d,hour(i));/*进行页面的调整,美观*/elseprintf(%d%d,o,hour(i));if(minute(i)=10)printf(%d,minute(i));elseprintf(%d%d,o,minute(i));printf(闽侯);wap(k);printf(%lf,times(k));printf(%d,number(k));printf(%d,nownumber(0,i));if(shour(i))printf(未发出);elseif(tminute(i)&&s==hour(i))printf(未发出);elseprintf(已发出);printf(\n);if(i==m){flag=1;k++;}if(k6)break;}}/*班次一览*/voidchaxun1(ints,intt){system(cls);inti,k=0,n,o=0;printf(\n请输入要查询的班次i:);scanf(%d,&i);n=i;while(n0){k++;n=n-tangci(k);}printf(班次发车时间起点站终点站

1 / 20
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功