社区
C语言
帖子详情
C语言编写车票管理系统
我偷老干妈养你
2019-06-19 01:24:56
写了两百行左右 有13个运行错误(估计逻辑错误也挺多的) 明天要交作业了 图三是最近一次运行出现的第一个错误 自己已经从一百多个错误改起了 在线挣扎求助
...全文
167
3
打赏
收藏
C语言编写车票管理系统
写了两百行左右 有13个运行错误(估计逻辑错误也挺多的) 明天要交作业了 图三是最近一次运行出现的第一个错误 自己已经从一百多个错误改起了 在线挣扎求助
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
我偷老干妈养你
2019-06-19
打赏
举报
回复
1 8:00 pixian guanghan 2 45 30
2 6:30 pixian chengdu 0.5 40 40
3 7:00 pixian chengdu 0.5 40 20
4 10:00 pixian chengdu 0.5 40 2
我偷老干妈养你
2019-06-19
打赏
举报
回复
//6-车票管理系统 #include<stdio.h> #include<stdlib.h> #define N 4 void record(); //录入信息 void mune(); //菜单 void findsdate(); //查询状态 void findroute(); //查询路线 void book(); //预定车票 void refund(); //退票 struct time { int hour; int minute; }; struct infor //定义汽车信息 { int shift; //汽车的班次 struct time start; //发车时间,输入形式为 08:00 char spoint[20]; //起始站 char dest[20]; //终点站 float hour; //行车时间 int num; //额定数量 int snum; //已售数量 } infor[N-1] ; int main() { printf("\n\n----------------------------------车票管理系统--------------------------------\n"); printf("录入班车信息\n输入信息:\n"); int i; for(i=0;i<N;i++) { scanf("%d%d:%d%s%s%f%d%d",&infor[i].shift,&infor[i].start.hour,&infor[i].start.minute, infor[i].spoint,infor[i].dest,&infor[i].hour, &infor[i].num,&infor[i].snum); // 键盘输入信息 } record(); printf("\n\n选择您要进行的操作: \n"); printf("查询所有班次当前状态----1\n\n"); printf("查询汽车路线------------2\n\n"); printf("购买车票----------------3\n\n"); printf("退订车票----------------4\n\n"); mune(); printf(" 感谢您的使用 \n"); } void record() //录入信息 { int i; FILE *fp; if((fp=fopen("qichexinxi.dat","wb"))==NULL) { printf("文件不存在\n"); exit(0); } for(i=0;i<N;i++) if(fwrite(&infor[i],sizeof(struct infor),1,fp)!=1) printf("文件出错\n"); fclose(fp) ; } void mune() //菜单选项 { int m; scanf("%d",&m) ; switch(m) case 1: { char c; findsdate(); printf("按任意键退出系统\n"); printf("按 # 返回上一层\n"); printf("请输入: \n"); scanf("%c",c); if(c=='#') mune(); }; break; case 2: { char c; findroute(); printf("按任意键退出系统\n"); printf("按 # 返回上一层\n"); printf("请输入: \n") ; scanf("%c",c); if(c=='#') mune(); }; break; case 3: { char c; book(); printf("按任意键退出系统\n"); printf("按 # 返回上一层\n"); printf("请输入: \n"); scanf("%c",c); if(c=='#') mune(); }; break; case 4: { char c; refund(); printf("按任意键退出系统\n"); printf("按 # 返回上一层\n"); printf("请输入: \n"); scanf("%c",c); if(c=='#') mune(); }; break; } void findsdate()//查询状态 { int i; struct time now; scanf("%d%d",&now.hour,&now.minute);//输入系统时间 printf("当前时间%d:%d",now.hour,now.minute); if(now.hour>23||now.hour<0||now.minute>59||now.minute<0) { printf("输入错误,请输入正确时间\n"); getchar(); getchar(); } for(i=0;i<N;i++) { if (now.hour<=infor[i].start.hour&&now.minute<=infor[i].start.minute) printf("汽车%d未发出\n",i); else printf("汽车%d发出\n",i); } mune(); } void findroute() { int i; printf("请选择查询方式:\n") ; printf("按班次查询------1\n"); printf("按终点站查询----2\n"); scanf("%d",&i); if(i!=1&&i!=2) printf("输入错误,请重新输入\n"); switch(i) case 1: { int j; printf("请输入班次:\n"); scanf("%d",&j); if(j>N) printf("输入错误,请重新输入\n"); printf("班次%d:/t\t%d%d:%d%s%s%f%d%d",infor[j-1].shift,infor[j-1].start.hour,infor[j-1].start.minute, infor[j-1].spoint,infor[j-1].dest,infor[j-1].hour, infor[j-1].num,&infor[j-1].snum); }; break; case 2: { char c1; int i; for(i=0;i<N;i++) { if(c1=infor[i].dest) printf("班次%d:/t\t%d%d:%d%s%s%f%d%d",i,infor[i-1].shift,infor[i-1].start.hour,infor[i-1].start.minute, infor[i-1].spoint,infor[i-1].dest,infor[i-1].hour, infor[i-1].num,&infor[i-1].snum); else printf("未查询到\n"); }; } break; } void book() { int i; struct time now; printf("请输入要订购的车票的班次:"); scanf("%d", &i); printf("i=%d\n", i); if (i < 1 || i > N + 1) { printf("对不起,今天没有这趟车,请明天再来,谢谢使用!\n"); printf("按任意键回主菜单......\n"); getchar(); mune(); } scanf("%d%d",&now.hour,&now.minute);//输入系统时间 printf("当前时间%d:%d",now.hour,now.minute); if (now.hour<=infor[i-1].start.hour&&now.minute<=infor[i-1].start.minute) { if (infor[i - 1].snum < infor[i - 1].num) { (infor[i - 1].snum)++; printf("你的订票成功,请按时上车,谢谢使用!\n"); } else printf("对不起,今天的这趟车的票已卖完,请明天再来,谢谢合作!\n"); } getchar(); menu(); } void refund() { int i; printf("请输入要退购的车票的班次:"); scanf("%d", &i); if (i < 1 || i >N + 1) { printf("对不起,今天没有这趟车,无法完成退票.谢谢使用!\n"); getchar(); mune(); } scanf("%d%d",&now.hour,&now.minute);//输入系统时间 printf("当前时间%d:%d",now.hour,now.minute); if (now.hour>=infor[i-1].start.hour&&now.minute>=infor[i-1].start.minute) if (infor[i - 1].snum >= 1) { infor[i - 1].snum = infor[i - 1].snum-1; printf("退订车票成功,谢谢使用!\n"); } else printf("对不起,今天的这趟车的票尚未卖出,无法完成退票!\n"); else printf("对不起,今天的这趟车已发出,无法完成退票!\n"); }
自信男孩
2019-06-19
打赏
举报
回复
建议直接贴代码吧,贴图片不清晰
代码如果比较多,那就多发几个
火
车票
管理系统
(
C语言
编写
)
用
C语言
编写
的,参考了一些材料,希望能够对别人有所帮助
c语言
关于
车票
管理系统
的讲解
在本讲解中,我们将深入探讨一个使用
C语言
编写
的
车票
管理系统
。
车票
管理系统
是计算机科学中的一个基础项目,它可以帮助我们理解如何利用
C语言
处理实际问题,如数据存储、查询和更新。在这个简单的系统中,我们将关注...
c语言
车票
管理系统
代码
标题"
C语言
车票
管理系统
代码"表明该代码是一个使用
C语言
编写
的
车票
管理系统
的实现代码,该系统能够对
车票
进行管理、查询和操作。 描述分析 描述"聚会
车票
管理系统
代码
车票
管理系
车票
管理系统
代码统代码
车票
管理...
火
车票
管理系统
_
C语言
管理系统
_
【火
车票
管理系统
_
C语言
管理系统
】是一个使用
C语言
开发的课程设计项目,主要目的是让学生掌握
C语言
编程基础以及数据结构中的链表应用。在这个系统中,核心功能包括对火
车票
信息的增加、删除、修改和查询,这些都是...
C语言
编写
的火
车票
管理系统
火
车票
管理系统
,typedef struct ST1 { char name[10]; //乘客姓名 char IDcard[20]; //乘客身份证号码 int TicketNum; //订票数 float FareSum; //总票价 struct ST1 *next; }ST1; typedef struct...
C语言
70,021
社区成员
243,263
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章