-
2021-05-20 08:45:04
#include"stdio.h"
#include"stdlib.h"
#include"string.h"/*定义头文件,处理文件及字符数组时要用到相应功能*/
#define N 10
void fmenu()
{
system("cls");
printf("************************欢迎使用苏州列车时刻表信息管理系统v1.20*****************\n");
printf("\t\t\t\t %c1. 查询列车\n",3);
printf("\n");
printf("\t\t\t\t %c2. 修改列车\n",3);
printf("\n");
printf("\t\t\t\t %c3. 增加列车\n",3);
printf("\n");
printf("\t\t\t\t %c4. 取消列车\n",3);
printf("\n");
printf("\t\t\t\t %c5. 保存信息\n",3);
printf("\n");
printf("\t\t\t\t %c0. 退出\n",3);
printf("********************************************************************* ***********\n");
printf("请选择要执行的操作:\n");/*菜单程序,用于各种功能的选择*/
}
struct train/*定义结构体*/
{
char name[8];
char checi[6];
int year;
int month;
int day;
int hour;
int minute;
}lieche[N];/*定义一个结构体数组*/
void paixu(struct train *p);/*函数声明*/
void chaxun(struct train *p)/*子程序,其功能是查询列车*/
{
paixu(lieche);/*先排序一下,方便查看*/
char a[8];/*定义一个字符数组,输入要查询的列车*/
int k=0,i,c;
printf("请输入要查询的列车:\n");
scanf("%s",a);
for(i=0;i
更多相关内容 -
C语言 实现带菜单的火车列车时刻表,查询系统;
2012-06-04 11:29:06带菜单的,适合课设用。 printf("\n ||===============目录============||\n"); printf(" 添加信息......1\n"); printf(" 查看所有.......2\n"); printf(" 查找车辆.......3\n"); printf(" 删除车辆.......4\n... -
列车时刻表管理源代码(C语言)
2007-08-02 22:46:25列车时刻表管理C语言源代码,功能不是很多,不过程序出错率比较低, -
列车时刻管理系统C语言程序设计(源代码)
2020-11-21 13:10:14列车时刻管理系统C语言程序设计(源代码),适合初级C语言学习的朋友参考练习,对编写小程序有一定帮助,希望能对C语言爱好者有所帮助。 -
用c语言编写的列车时刻表
2011-01-06 15:44:04很强大的功能呢,有查删改查排序等基本功能实现,对数据的保存的实现。 -
华中科技大学课程设计--C语言课程设计-- 列车时刻表信息管理系统
2019-01-14 08:43:11设计文档:GitHub传送门 C语言代码: /*******************************************************.../* 项目名称:列车时刻表信息管理系统 /* 最后修改时间:2016-09-24 /* 开发环境: VC6.0; /* 作者:覃家旺 ...设计文档:GitHub传送门
C语言代码:/************************************************************************/ /* 项目名称:列车时刻表信息管理系统 /* 最后修改时间:2016-09-24 /* 开发环境: VC6.0; /* 作者:QJW /************************************************************************/ #include <stdio.h> #include "info.H" #include <malloc.h> #include <windows.h> int main() { while(1) { Menu(); system("pause"); } return 0; } /** * 函数名称:Menu * 函数功能:显示菜单 * 输入参数:无 * 返回值:无 **/ void Menu() { int option = 0; //修改控制台标题 system("title 列车时刻表信息管理系统"); //设置控制台尺寸 system(WIN_SIZE); //把背景设置为 浅绿色 system("color 3e"); //显示主菜单 showMenu(0); } int Scanf(int left,int top) { int option; setTop(top); setLeft(left); printf("请选择:"); scanf("%d",&option); return option; } /** * 函数名称:showMenu * 函数功能:显示菜单 * 输入参数:option选项值 * 返回值:选项序号 **/ int showMenu(int option) { //选项item int select; //主菜单list char *title[]={"数据管理","数据查询","数据统计","退出系统",""}; //数据管理list char *title_data[]={"车次管理","经停车站管理","经停车站信息管理","返回主菜单","退出系统",""}; //车次管理list char *title_trains[]={"新增车次","修改车次","删除车次","返回上一级菜单","返回主菜单","退出系统",""}; //经停车站list char *title_stops[]={"新增经停车站","修改经停车站","删除经停车站","返回上一级菜单","返回主菜单","退出系统",""}; //经停车站信息 char *title_stops_inf[]={"新增经停车站信息","修改经停车站信息","删除经停车站信息","返回上一级菜单","返回主菜单","退出系统",""}; //查询 char *query_list[]={"简单列表","复合查询","返回主菜单","退出系统",""}; //简单列表 char *query_simple_list[]={"车次列表","车次经停站列表","经停站列表","返回上一级菜单","返回主菜单","退出系统",""}; switch(option) { case 0: //主菜单 drawMenu(title,50,10,2,true); load();//加载数据 select = Scanf(50,0) ; if(select == 1) showMenu(1); if(select == 2) showMenu(3); if(select == 3) tongji(); if(select == 4) exit(0); break; case 1: //数据管理 drawMenu(title_data,50,10,2,true); select = Scanf(50,0) ; if(select == 1) showMenu(2); if(select == 2) showMenu(4); if(select == 3) showMenu(5); break; case 2: //车次管理 system("cls"); drawMenu(title_trains,50,10,2,true); select = Scanf(50,0) ; if(select == 1) add_train(); if(select == 2) change_train(); if(select == 3) delete_train(); if(select == 4) showMenu(1); if(select == 5) showMenu(0); if(select == 6) exit(0); break; case 3: drawMenu(query_list,50,10,2,true); select = Scanf(50,0) ; if(select == 1) showMenu(6); if(select == 2) sigle(1); if(select == 3) showMenu(0); if(select == 4) exit(0); break; case 4: //经停车站管理 drawMenu(title_stops,50,10,2,true); select = Scanf(50,0) ; if(select == 1) add_stop(); if(select == 2) change_stop(); if(select == 3) delete_stop(); if(select == 4) showMenu(1); if(select == 5) showMenu(0); if(select == 6) exit(0); break; case 5: //经停车站信息 drawMenu(title_stops_inf,50,10,2,true); select = Scanf(50,0) ; if(select == 1) add_stop_inf(); if(select == 2) change_stop_inf(); if(select == 3) delete_stop_inf(); if(select == 4) showMenu(1); if(select == 5) showMenu(0); if(select == 6) exit(0); break; case 6: drawMenu(query_simple_list,50,10,2,true); select = Scanf(50,0) ; if(select == 1) simple_list(1); if(select == 2) simple_list(2); if(select == 3) simple_list(3); if(select == 4) showMenu(3); if(select == 5) showMenu(0); if(select == 6) exit(0); break; } return option; } /** * 函数名称:drawMenu * 函数功能:绘制一个菜单 * 输入参数: * str:选项名称 多个选项用空格隔开(如:"数据管理","数据查询","数据统计","退出系统","") * left(>0): 列表与左边的宽度 按空格计算 * top(>0): 列表离顶端的高度 按行计算 * line_height(>0):行高 * line_flag(true|false):是否显示行标号 * 返回值:列表项目数量 **/ int drawMenu(char *str[],int left,int top,int line_height,bool line_flag) { int i = 0,j,k,p; int count = 1; int max=0; int maxStrLength = 0; int last; // while(strcmp(str[i],"")!=0) { max = strlen(str[i]); if(max>maxStrLength) maxStrLength = max; i++; } i=0; system("cls"); //控制上间距 setTop(top); while(strcmp(str[i],"")!=0) { //控制左间距 setLeft(left); if(i==0 ) for(k=1;k<=maxStrLength/2+1;k++) { if(k==1)printf("┌"); printf("——"); if(k==maxStrLength/2+1) printf("┐\n\n\n\n"); } if(i==0) { setLeft(50); } if(line_flag) printf("¤ %d.",count); printf("%s",str[i++]); count ++; //控制行高 setTop(line_height); } printf("\n\n\n\n"); setLeft(50); for(k=1;k<=maxStrLength/2+1;k++) { if(k==1)printf("└"); printf("——"); if(k==maxStrLength/2+1) printf("┘\n"); } return count-1; } /** * 函数名称:setLeft * 函数功能:控制左间距 * 输入参数:left(>0) 左间距 * 返回值:左间距 **/ int setLeft(int left) { for(int j = 0;j<left;j++) printf(" "); return left; } /** * 函数名称:setTop * 函数功能:控制上间距 * 输入参数:top>0) 上间距 * 返回值: 上间距 **/ int setTop(int top) { for(int j =0 ;j<top;j++) printf("\n"); return top; } void add_train() { PTrainInfo head,p1,p2; FILE *fp; head = p1 = (PTrainInfo)malloc(TRAINSIZE); if((fp = fopen("train.txt","ab+"))==NULL || p1==NULL) Error(); system("cls"); setTop(10); setLeft(50); printf(" 车次编号:"); scanf("%s",p1->trainId); printf("\n"); //判断车次编号是否重复 p2 =findTrain(-1,p1->trainId,-1); if(p2!=NULL) { printf("记录重复,录入失败.\n"); system("pause"); return; } setLeft(50); printf(" 车次名称:"); scanf("%s",p1->trainName); printf("\n"); setLeft(50); printf(" 车次类型编码:"); scanf("%s",p1->trainCode); printf("\n"); setLeft(50); printf(" 车次类型名称:"); scanf("%s",p1->typeName); printf("\n"); setLeft(50); printf(" 所属路局编号:"); scanf("%s",p1->rodeId); printf("\n"); setLeft(50); printf(" 所属路局名称:"); scanf("%s",p1->rodeName); printf("\n"); setLeft(50); printf(" 始发站:"); scanf("%s",p1->startStaion); printf("\n"); setLeft(50); printf(" 始发时间:"); scanf("%s",p1->startTime); printf("\n"); setLeft(50); printf(" 终到站:"); scanf("%s",p1->endStation); printf("\n"); setLeft(50); printf(" 终到时间:"); scanf("%s",p1->endTime); printf("\n");//float f=0.0;//避免floating not load setLeft(50); printf(" 硬卧下铺全程票价:"); scanf("%f",&p1->hardLwr); printf("\n"); setLeft(50); printf(" 硬卧中铺全程票价:"); scanf("%f",&p1->hardMid); printf("\n"); setLeft(50); printf(" 硬卧上铺全程票价:"); scanf("%f",&p1->hardUpper); printf("\n"); setLeft(50); printf(" 软卧下铺全程票价:"); scanf("%f",&p1->softLwr); printf("\n"); setLeft(50); printf(" 软卧上铺全程票价:"); scanf("%f",&p1->softUpper); printf("\n"); setLeft(50); printf(" 硬座全程票价:"); scanf("%f",&p1->hardSit); printf("\n"); setLeft(50); printf(" 全程运行时间:"); scanf("%s",p1->fullTime); printf("\n"); setLeft(50); printf(" 全程运行里程:"); scanf("%d",&p1->fullMile); printf("\n"); fwrite(p1,TRAINSIZE,1,fp); setLeft(50); printf("保存成功!"); fclose(fp); } void change_train() { print_train(true); } void load() { PTrainInfo p ,p1; FILE *fp; p = train_info = (PTrainInfo)malloc(TRAINSIZE); if((fp=fopen("train.txt","rb"))==NULL) Error(); p1 = (PTrainInfo)malloc(TRAINSIZE); p->trainNext = p1; p = p1; while ((fread(p1,TRAINSIZE,1,fp))==1) { p1 = (PTrainInfo)malloc(TRAINSIZE); p->trainNext = p1; p = p1; } p->trainNext = NULL; fclose(fp); // //加载经停车站 PStopStation p2 ,p2_; FILE *fp1; p2= stop_station = (PStopStation)malloc(STOPSIZE); if((fp1=fopen("stoptstaion.txt","rb"))==NULL) Error(); p2_ = (PStopStation)malloc(STOPSIZE); p2->stopNext = p2_; p2 = p2_; while ((fread(p2_,STOPSIZE,1,fp))==1) { p2_ = (PStopStation)malloc(STOPSIZE); p2->stopNext = p2_; p2 = p2_; } p2->stopNext = NULL; fclose(fp1); // //加载经停站信息 PStopStationInf p3 ,p4; FILE *fp2; p3 = sotp_station_info = (PStopStationInf)malloc(STOPINFSIZE); if((fp2=fopen("stoptstaion_inf.txt","rb"))==NULL) Error(); p4 = (PStopStationInf)malloc(STOPINFSIZE); p3->stopTrainNext = p4; p3 = p4; while ((fread(p4,STOPINFSIZE,1,fp2))==1) { p4 = (PStopStationInf)malloc(STOPINFSIZE); p3->stopTrainNext = p4; p3 = p4; } p3->stopTrainNext = NULL; fclose(fp2); } void Error() { setLeft(40); printf("操作失败!"); system("pause"); showMenu(0); } void print_train(bool div) { PTrainInfo p = train_info; int option; system("cls"); setTop(10); lists(1,1,true); printf("Tips:输入0返回主菜单"); option = Scanf(0,0); if(option == 0) showMenu(0); else { tail = findTrain(option,"",-1); p = tail->trainNext; system("cls"); lists(1,-1,false); option = Scanf(0,0); //列修改项目 if(option == 1)printf(" 车次编号不能修改。\n\n"); if(option == 2) {setLeft(50); printf("2.车次名称:"); scanf("%s",p->trainName);printf("\n");} if(option == 3) {setLeft(50); printf("3.车次类型编码:"); scanf("%s",p->trainCode);printf("\n");} if(option == 4) {setLeft(50); printf("4.车次类型名称:"); scanf("%s",p->typeName);printf("\n");} if(option == 5) {setLeft(50); printf("5.所属路局编号:"); scanf("%s",p->rodeId);printf("\n");} if(option == 6) {setLeft(50); printf("6.所属路局名称:"); scanf("%s",p->rodeName);printf("\n");} if(option == 7) {setLeft(50); printf("7.始发站:"); scanf("%s",p->startStaion);printf("\n");} if(option == 8) {setLeft(50); printf("8.始发时间:"); scanf("%s",p->startTime);printf("\n");} if(option == 9) {setLeft(50); printf("9.终到站:"); scanf("%s",p->endStation);printf("\n");} if(option == 10) {setLeft(50); printf("10.终到时间:"); scanf("%s",p->endTime);printf("\n");} if(option == 11) {setLeft(50); printf("11.硬卧下铺全程票价:"); scanf("%f",&p->hardLwr);printf("\n");} if(option == 12) {setLeft(50); printf("12.硬卧中铺全程票价:"); scanf("%f",&p->hardMid);printf("\n");} if(option == 13) {setLeft(50); printf("13.硬卧上铺全程票价:"); scanf("%f",&p->hardUpper);printf("\n");} if(option == 14) {setLeft(50); printf("14.软卧下铺全程票价:"); scanf("%f",&p->softLwr);printf("\n");} if(option == 15) {setLeft(50); printf("15.软卧上铺全程票价:"); scanf("%f",&p->softUpper);printf("\n");} if(option == 16) {setLeft(50); printf("16.硬座全程票价:"); scanf("%f",&p->hardSit);printf("\n");} if(option == 17) {setLeft(50); printf("17.全程运行时间:"); scanf("%s",p->fullTime);printf("\n");} if(option == 18) {setLeft(50); printf("18.全程运行里程:"); scanf("%d",&p->fullMile);printf("\n");} Write(1,0,p->trainId); } } PTrainInfo findTrain(int n,char *str,int rhs) { int i=1; post = n; int flag=0; PTrainInfo p = train_info; if(n==10) { //查始发站 //按ID查 while(p->trainNext->trainNext!=NULL) { p = p->trainNext; if(rhs==1 && strcmp(p->startStaion,strs)==0 )flag =1; else if(rhs==2 && strcmp(p->startTime,strs)==0) flag = 1; else if(rhs == 3 && strcmp(p->endStation,strs)==0)flag = 1; else if(rhs==4 && strcmp( p->fullTime,strs)==0)flag = 1; else if(rhs== 5 && p->fullMile==atoi(strs))flag = 1; else if(rhs== 6 && p->hardLwr-atoi(strs)<1e-10)flag = 1; else if(rhs== 7 && strcmp( p->endTime,strs)==0)flag = 1; else if(rhs==8 && strcmp( p->trainId,strs)==0)return p; else if(rhs==9 && strcmp( p->startTime,strs)==0) flag = 1; else flag = 0; if(flag) { p11 = p; setLeft(40); printf("------------------------------------------------------------------------------\n"); setLeft(48); printf("车次编号:%s\n\n",p11->trainId); setLeft(50); printf("车次名称:%s\n\n",p11->trainName); setLeft(50); printf("车次类型编码:%s\n\n",p11->trainCode); setLeft(50); printf("车次类型名称:%s\n\n",p11->typeName); setLeft(50); printf("所属路局编号:%s",p11->rodeId); printf("\n\n"); setLeft(50); printf("所属路局名称:%s\n\n",p11->rodeName); setLeft(50); printf("始发站:%s\n\n",p11->startStaion); setLeft(50); printf("始发时间:%s\n\n",p11->startTime); setLeft(50); printf("终到站:%s\n\n",p11->endStation); setLeft(50); printf("终到时间:%s\n\n",p11->endTime); setLeft(50); printf("硬卧下铺全程票价:%0.2f\n\n",p11->hardLwr); setLeft(50); printf("硬卧中铺全程票价:%0.2f\n\n",p11->hardMid); setLeft(50); printf("硬卧上铺全程票价:%0.2f\n\n",p11->hardUpper); setLeft(50); printf("软卧下铺全程票价:%0.2f\n\n",p11->softLwr); setLeft(50); printf("软卧上铺全程票价:%0.2f\n\n",p11->softUpper); setLeft(50); printf("硬座全程票价:%0.2f\n\n",p11->hardSit); setLeft(50); printf("全程运行时间:%s\n\n",p11->fullTime); setLeft(50); printf("全程运行里程:%d\n\n",p11->fullMile); if(rhs == 8) break; i++; if(rhs == 9 && i>3) break; } } return p11; } if(n!=0 && n>0) //按节点位置查 for( i =1;i<n;i++) p = p->trainNext; //n==-1表示 查询是否存在str(ID)字段 else if(n==-1) { while(p->trainNext!=NULL) { p = p->trainNext; if(strcmp(p->trainId,str)==0) return p; } return NULL; } else { //按ID查 while(p->trainNext!=NULL) { p = p->trainNext; if(strcmp(p->trainId,str)==0) break; } } return p; } void Write(int n,int pos,char *str) { FILE *fp,*fp1,*fp3; int count = 0;//节点计数器 //n==1 车次基本信息链表 if(n==1) { fp = fopen("train.txt","wb"); PTrainInfo p1,p = train_info; while(p->trainNext->trainNext!=NULL) { p = p->trainNext; count++; if(pos==0) fwrite(p,TRAINSIZE,1,fp); //pos == -1 删除指定节点 if(strcmp(str,"del")==0) { p1 = findTrain(pos,"",-1)->trainNext; if(count != post) fwrite(p,TRAINSIZE,1,fp); } } fclose(fp); } else if(n==2) { count=0; //停车站 fp1 = fopen("stoptstaion.txt","wb"); PStopStation p1,p=stop_station; while(p->stopNext->stopNext!=NULL) { p = p->stopNext; count++; //pos == 0写整个链表 if(pos == 0) fwrite(p,STOPSIZE,1,fp1); //pos == -1 删除指定节点 if(strcmp(str,"del")==0) { p1 = findStop(pos,"")->stopNext; if(count != post) fwrite(p,STOPSIZE,1,fp1); } } fclose(fp1); } else if(n==3) { count=0; //停车站 fp3 = fopen("stoptstaion_inf.txt","wb"); PStopStationInf p1,p=sotp_station_info; while(p->stopTrainNext->stopTrainNext!=NULL) { p = p->stopTrainNext; count++; //pos == 0写整个链表 if(pos == 0) fwrite(p,STOPINFSIZE,1,fp3); //pos == -1 删除指定节点 if(strcmp(str,"del")==0) { p1 = findStopInf(pos,"")->stopTrainNext; if(count != post) fwrite(p,STOPINFSIZE,1,fp3); } } fclose(fp3); } } void lists(int n,int many,bool ul) { //n == 1车次基本信息列表 PTrainInfo p = train_info; PStopStation p1 = stop_station; PStopStationInf p2 = sotp_station_info; int i=1; if(n==1) { int page = 7; if(tail!=NULL && many<0) p = tail; while(p->trainNext->trainNext!=NULL) { p = p->trainNext; setLeft(40); printf("------------------------------------------------------------------------------\n"); setLeft(48); if(ul) printf("%d.",i);else printf("1.");printf("车次编号:%s\n\n",p->trainId); setLeft(50); if(!ul)printf("2.");printf("车次名称:%s\n\n",p->trainName); setLeft(50); if(!ul)printf("3.");printf("车次类型编码:%s\n\n",p->trainCode); setLeft(50); if(!ul)printf("4.");printf("车次类型名称:%s\n\n",p->typeName); setLeft(50); if(!ul)printf("5.");printf("所属路局编号:%s",p->rodeId); printf("\n\n"); setLeft(50); if(!ul)printf("6.");printf("所属路局名称:%s\n\n",p->rodeName); setLeft(50); if(!ul)printf("7.");printf("始发站:%s\n\n",p->startStaion); setLeft(50); if(!ul)printf("8.");printf("始发时间:%s\n\n",p->startTime); setLeft(50); if(!ul)printf("9.");printf("终到站:%s\n\n",p->endStation); setLeft(50); if(!ul)printf("10.");printf("终到时间:%s\n\n",p->endTime); setLeft(50); if(!ul)printf("11.");printf("硬卧下铺全程票价:%0.2f\n\n",p->hardLwr); setLeft(50); if(!ul)printf("12.");printf("硬卧中铺全程票价:%0.2f\n\n",p->hardMid); setLeft(50); if(!ul)printf("13.");printf("硬卧上铺全程票价:%0.2f\n\n",p->hardUpper); setLeft(50); if(!ul)printf("14.");printf("软卧下铺全程票价:%0.2f\n\n",p->softLwr); setLeft(50); if(!ul)printf("15.");printf("软卧上铺全程票价:%0.2f\n\n",p->softUpper); setLeft(50); if(!ul)printf("16.");printf("硬座全程票价:%0.2f\n\n",p->hardSit); setLeft(50); if(!ul)printf("17.");printf("全程运行时间:%s\n\n",p->fullTime); setLeft(50); if(!ul)printf("18.");printf("全程运行里程:%d\n\n",p->fullMile); i++; if(many<0) break; } } else if(n==2) { //列表停车站 if(tail2!=NULL && many<0) p1 = tail2; while(p1->stopNext->stopNext!=NULL) { p1 = p1 ->stopNext; setLeft(40); printf("------------------------------------------------------------------------------\n"); setLeft(50);if(ul)printf("%d.",i);else printf("1.");printf("车站编号:%s\n\n",p1->stationId); setLeft(50);if(!ul)printf("2.");printf("经停车次编号:%s\n\n",p1->stopid); setLeft(50);if(!ul)printf("3.");printf("经停车次名称:%s\n\n",p1->soptTrainName); setLeft(50);if(!ul)printf("4.");printf("路局编号:%s\n\n",p1->rodeId); setLeft(50);if(!ul)printf("5.");printf("车次类型:%s\n\n",p1->trainType); setLeft(50);if(!ul)printf("6.");printf("进站时间:%s\n\n",p1->atTime); setLeft(50);if(!ul)printf("7.");printf("开车时间:%s\n\n",p1->leaveTime); setLeft(50);if(!ul)printf("8.");printf("硬卧下铺全程票价:%0.2f\n\n",p1->hardLwr); setLeft(50);if(!ul)printf("9.");printf("硬卧中铺全程票价:%0.2f\n\n",p1->hardMid); setLeft(50);if(!ul)printf("10.");printf("硬卧上铺全程票价:%0.2f\n\n",p1->hardUpper); setLeft(50);if(!ul)printf("11.");printf("软卧下铺全程票价:%0.2f\n\n",p1->softLwr); setLeft(50);if(!ul)printf("12.");printf("软卧上铺全程票价:%0.2f\n\n",p1->softUpper); setLeft(50);if(!ul)printf("13.");printf("硬座全程票价:%0.2f\n\n",p1->hardSit); setLeft(50);if(!ul)printf("14.");printf("余票车次数量:%d\n\n\n",p1->leftTicket); i++; if(many<0) break; } } else if(n==11) { //n==11仅打印车次号 p = train_info; while(p->trainNext->trainNext!=NULL) { p = p->trainNext; setLeft(70); printf("%d.%s\n",i,p->trainId); i++; } } else if(n==21) { //获取经停车站编号列表 p1 = stop_station; while(p1->stopNext->stopNext!=NULL) { p1 = p1->stopNext; setLeft(70); printf("%d.%s\n",i,p1->stationId); i++; } } else if(n==31) { //经停车站 if(tail3!=NULL && many<0) p2 = tail3; if(p33!=NULL ) p2 = p33; while(p2->stopTrainNext->stopTrainNext!=NULL) { p2 = p2 ->stopTrainNext; setLeft(40); printf("------------------------------------------------------------------------------\n"); setLeft(50);if(ul)printf("%d.",i);else printf("1.");printf("车站编号:%s\n\n",p2->stationidI); setLeft(50);if(!ul)printf("2.");printf("车次编号:%s\n\n",p2->trainType); setLeft(50);if(!ul)printf("3.");printf("车站名称:%s\n\n",p2->stopName); setLeft(50);if(!ul)printf("4.");printf("所属路局编号:%s\n\n",p2->stopRodeId); setLeft(50);if(!ul)printf("5.");printf("到站时间:%s\n\n",p2->atStation); setLeft(50);if(!ul)printf("6.");printf("开车时间:%s\n\n",p2->driveTime); setLeft(50);if(!ul)printf("7.");printf("运行时间:%s\n\n",p2->runTime); setLeft(50);if(!ul)printf("8.");printf("运行里程:%d\n\n",p2->runMile); setLeft(50);if(!ul)printf("9.");printf("硬卧下铺全程票价:%0.2f\n\n",p2->hardLwr); setLeft(50);if(!ul)printf("10.");printf("硬卧中铺全程票价:%0.2f\n\n",p2->hardMid); setLeft(50);if(!ul)printf("11.");printf("硬卧上铺全程票价:%0.2f\n\n",p2->hardUpper); setLeft(50);if(!ul)printf("12.");printf("软卧下铺全程票价:%0.2f\n\n",p2->softLwr); setLeft(50);if(!ul)printf("13.");printf("软卧上铺全程票价:%0.2f\n\n",p2->softUpper); setLeft(50);if(!ul)printf("14.");printf("硬座全程票价:%0.2f\n\n",p2->hardSit); setLeft(50);if(!ul)printf("15.");printf("余票车次数量:%d\n\n\n",p2->leftTicket); i++; if(many<0) break; } } } void delete_train() { int option; system("cls"); lists(1,1,true); setLeft(50); printf("输入0返回主菜单\n"); option = Scanf(50,0); if(option ==0) return; Write(1,option,"del"); } int getLength(int li) { int i = 0; if(li==1) { //计算车次数量 PTrainInfo p=train_info; while(p->trainNext->trainNext!=NULL) { p = p->trainNext; i++; } } else if(li==2) { //计算停车站数量 PStopStation p=stop_station; while(p->stopNext->stopNext!=NULL) { p = p->stopNext; i++; } } else if(li==3) { //计算停车站信息节点数量 PStopStationInf p=sotp_station_info; while(p->stopTrainNext->stopTrainNext!=NULL) { p = p->stopTrainNext; i++; } } else if(li==4) { //查询动车数量 i=0; PTrainInfo p=train_info; while(p->trainNext->trainNext!=NULL) { p = p->trainNext; if(strcmp(p->trainCode,"D")==0) i++; } } else if(li==5) { //Z i=0; PTrainInfo p=train_info; while(p->trainNext->trainNext!=NULL) { p = p->trainNext; if(strcmp(p->trainCode,"Z")==0) i++; } } else if(li == 6) { //查询余票为0的车站数 PStopStation p=stop_station; while(p->stopNext->stopNext!=NULL) { p = p->stopNext; if(p->leftTicket==0) i++; } } else if(li == 7) { PStopStation p=stop_station; while(p->stopNext->stopNext!=NULL) { p = p->stopNext; PTrainInfo p1=train_info; while(p1->trainNext->trainNext!=NULL) { p1 = p1->trainNext; if(strcmp(p1->trainId,p->stopid)==0 && p->leftTicket!=0) i++; } } } return i; } //经停车站 void add_stop() { PStopStation head,p1,p2; PTrainInfo pt = NULL; FILE *fp; int option; head = p1 = (PStopStation)malloc(STOPSIZE); if((fp = fopen("stoptstaion.txt","ab+"))==NULL || p1==NULL) Error(); system("cls"); setTop(10); setLeft(50); printf(" 车站编号:"); scanf("%s",p1->stationId); printf("\n"); //判断车次编号是否重复 p2 =findStop(-1,p1->stopid); if(p2!=NULL) { printf("记录重复,录入失败.\n"); system("pause"); return; } setLeft(50); printf(" 经停车次编号:\n"); //列表已存在的车次号 lists(11,0,false); option=Scanf(60,0); if(option >getLength(1)) { printf("操作错误"); system("pause"); return; } pt = findTrain(option,"",-1); if(pt==NULL) Error(); setLeft(60); printf("已选车次:%s\n\n",pt->trainNext->trainId); strcpy(p1->stopid,pt->trainNext->trainId); setLeft(50); printf(" 经停车次名称:"); scanf("%s",p1->soptTrainName); printf("\n"); setLeft(50); printf(" 路局编号:"); scanf("%s",p1->rodeId); printf("\n"); setLeft(50); printf(" 车次类型:"); scanf("%s",p1->trainType); printf("\n"); setLeft(50); printf(" 进站时间:"); scanf("%s",p1->atTime); printf("\n"); setLeft(50); printf(" 开车时间:"); scanf("%s",p1->leaveTime); printf("\n"); //float f=0.0;//避免floating not load setLeft(50); printf(" 硬卧下铺全程票价:"); scanf("%f",&p1->hardLwr); printf("\n"); setLeft(50); printf(" 硬卧中铺全程票价:"); scanf("%f",&p1->hardMid); printf("\n"); setLeft(50); printf(" 硬卧上铺全程票价:"); scanf("%f",&p1->hardUpper); printf("\n"); setLeft(50); printf(" 软卧下铺全程票价:"); scanf("%f",&p1->softLwr); printf("\n"); setLeft(50); printf(" 软卧上铺全程票价:"); scanf("%f",&p1->softUpper); printf("\n"); setLeft(50); printf(" 硬座全程票价:"); scanf("%f",&p1->hardSit); printf("\n"); setLeft(50); printf(" 余票车次数量:"); scanf("%d",&p1->leftTicket); printf("\n"); fwrite(p1,STOPSIZE,1,fp); setLeft(50); printf("保存成功!"); fclose(fp); } PStopStation findStop(int n,char *str) { int i=1; post = n; int max=0; PStopStation p = stop_station; if(n!=0 && n>0) //按节点位置查 for( i =1;i<n;i++) p = p->stopNext; //n==-1表示 查询是否存在str(ID)字段 else if(n==-1) { while(p->stopNext!=NULL) { p = p->stopNext; if(strcmp(p->stopid,str)==0) return p; } return NULL; } else { //按ID查 while(p->stopNext!=NULL) { p = p->stopNext; if(strcmp(p->stopid,str)==0) break; } } return p; } void change_stop() { system("cls"); setTop(10); lists(2,1,true); print_stop(); } void print_stop() { PStopStation p=stop_station; int option; system("cls"); setTop(10); lists(2,1,true); printf("Tips:输入0返回主菜单"); option = Scanf(0,0); if(option == 0) showMenu(0); else { if(option>getLength(2)) Error(); tail2 = findStop(option,""); printf("%s\n",tail2->stopNext); p = tail2->stopNext; system("cls"); lists(2,-1,false); option = Scanf(0,0); //列修改项目 if(option == 1)printf(" 车站编号不能修改。\n\n"); if(option == 2) {setLeft(50); printf("2.经停车次编号:"); scanf("%s",p->stopid);printf("\n");} if(option == 3) {setLeft(50); printf("3.经停车次名称:"); scanf("%s",p->soptTrainName);printf("\n");} if(option == 4) {setLeft(50); printf("4.路局编号:"); scanf("%s",p->rodeId);printf("\n");} if(option == 5) {setLeft(50); printf("5.车次类型:"); scanf("%s",p->rodeId);printf("\n");} if(option == 6) {setLeft(50); printf("6.进站时间:"); scanf("%s",p->atTime);printf("\n");} if(option == 7) {setLeft(50); printf("7.开车时间:"); scanf("%s",p->leaveTime);printf("\n");} if(option == 8) {setLeft(50); printf("8.硬卧下铺全程票价:"); scanf("%f",&p->hardLwr);printf("\n");} if(option == 9) {setLeft(50); printf("9.硬卧中铺全程票价:"); scanf("%f",&p->hardMid);printf("\n");} if(option == 10) {setLeft(50); printf("10.硬卧上铺全程票价:"); scanf("%f",&p->hardUpper);printf("\n");} if(option == 11) {setLeft(50); printf("11.软卧下铺全程票价:"); scanf("%f",&p->softLwr);printf("\n");} if(option == 12) {setLeft(50); printf("12.软卧上铺全程票价:"); scanf("%f",&p->softUpper);printf("\n");} if(option == 13) {setLeft(50); printf("13.硬座全程票价:"); scanf("%f",&p->hardSit);printf("\n");} if(option == 14) {setLeft(50); printf("14.余票车次数量:"); scanf("%d",&p->leftTicket);printf("\n");} Write(2,0,p->stationId); } } void delete_stop() { int option; system("cls"); lists(2,1,true); setLeft(50); printf("输入0返回主菜单\n"); option = Scanf(50,0); if(option ==0) return; Write(2,option,"del"); } void add_stop_inf() { PStopStationInf head,p1,p2,p3; PStopStation pt = NULL; FILE *fp; int option; head = p1 = (PStopStationInf)malloc(STOPINFSIZE); if((fp = fopen("stoptstaion_inf.txt","ab+"))==NULL || p1==NULL) Error(); system("cls"); setTop(10); p2 = (PStopStationInf)malloc(STOPINFSIZE); p1->stopTrainNext = p2; p2->stopTrainNext = NULL; setLeft(50); printf(" 车站编号列表:\n"); lists(21,-1,false); option = Scanf(60,0); if(option >getLength(2)) { printf("操作错误"); system("pause"); return; } pt = findStop(option+1,""); if(pt==NULL) Error(); setLeft(60); printf("已选车站:%s\n",pt->stationId); strcpy(p1->stationidI,pt->stationId); setLeft(50); printf(" 车次编号:"); scanf("%s",p1->trainType); printf("\n"); setLeft(50); printf(" 车站名称:"); scanf("%s",p1->stopName); printf("\n"); setLeft(50); printf(" 所属路局编号:"); scanf("%s",p1->stopRodeId); printf("\n"); setLeft(50); printf(" 到站时间:"); scanf("%s",p1->atStation); printf("\n"); setLeft(50); printf(" 开车时间:"); scanf("%s",p1->driveTime); printf("\n"); setLeft(50); printf(" 运行时间:"); scanf("%s",p1->runTime); printf("\n"); setLeft(50); printf(" 运行里程:"); scanf("%d",&p1->runMile); printf("\n"); //float f=0.0;//避免floating not load setLeft(50); printf(" 硬卧下铺全程票价:"); scanf("%f",&p1->hardLwr); printf("\n"); setLeft(50); printf(" 硬卧中铺全程票价:"); scanf("%f",&p1->hardMid); printf("\n"); setLeft(50); printf(" 硬卧上铺全程票价:"); scanf("%f",&p1->hardUpper); printf("\n"); setLeft(50); printf(" 软卧下铺全程票价:"); scanf("%f",&p1->softLwr); printf("\n"); setLeft(50); printf(" 软卧上铺全程票价:"); scanf("%f",&p1->softUpper); printf("\n"); setLeft(50); printf(" 硬座全程票价:"); scanf("%f",&p1->hardSit); printf("\n"); setLeft(50); printf(" 余票车次数量:"); scanf("%d",&p1->leftTicket); printf("\n"); fwrite(p1,STOPINFSIZE,1,fp); setLeft(50); printf("保存成功!"); fclose(fp); } PStopStationInf findStopInf(int n,char *str) { int i=1; post = n; PStopStationInf p = sotp_station_info; if(n==10) { //按车站编号查询 while(p->stopTrainNext!=NULL) { // printf("\n%s\n",str); p = p->stopTrainNext; if(strcmp(p->stationidI,str)==0) { // printf("\n%s\n",p->stationidI); return p; } } return NULL; } if(n!=0 && n>0) //按节点位置查 for( i =1;i<n;i++) p = p->stopTrainNext; //n==-1表示 查询是否存在str(ID)字段 else if(n==-1) { while(p->stopTrainNext!=NULL) { p = p->stopTrainNext; if(strcmp(p->stationidI,str)==0) return p; } return NULL; } else { //按ID查 while(p->stopTrainNext!=NULL) { p = p->stopTrainNext; if(strcmp(p->stationidI,str)==0) break; } } return p; } void change_stop_inf() { PStopStationInf p = sotp_station_info; int option; system("cls"); setTop(10); lists(31,1,true); /// setLeft(50); printf("Tips:输入0返回主菜单\n"); option = Scanf(50,0); if(option == 0) showMenu(0); else { if(option>getLength(3)) Error(); tail3 = findStopInf(option,""); p = tail3->stopTrainNext; system("cls"); lists(31,-1,false); option = Scanf(50,0); option++; //列修改项目 if(option == 1)printf(" 车站编号不能修改!\n\n"); if(option == 2) {setLeft(50); printf("1.车次编号:"); scanf("%s",p->trainType);printf("\n");} if(option == 3) {setLeft(50); printf("2.车站编号:"); scanf("%s",p->stopId);printf("\n");} if(option == 4) {setLeft(50); printf("3.车站名称:"); scanf("%s",p->stopName);printf("\n");} if(option == 5) {setLeft(50); printf("4.所属路局编号:"); scanf("%s",p->stopRodeId);printf("\n");} if(option == 6) {setLeft(50); printf("5.到站时间:"); scanf("%s",p->atStation);printf("\n");} if(option == 7) {setLeft(50); printf("6.开车时间:"); scanf("%s",p->driveTime);printf("\n");} if(option == 8) {setLeft(50); printf("7.运行时间:"); scanf("%s",p->runTime);printf("\n");} if(option == 9) {setLeft(50); printf("8.运行里程:"); scanf("%d",p->runMile);printf("\n");} if(option == 10) {setLeft(50); printf("9.硬卧下铺全程票价:"); scanf("%f",&p->hardLwr);printf("\n");} if(option == 11) {setLeft(50); printf("10.硬卧中铺全程票价:"); scanf("%f",&p->hardMid);printf("\n");} if(option == 12) {setLeft(50); printf("11.硬卧上铺全程票价:"); scanf("%f",&p->hardUpper);printf("\n");} if(option == 13) {setLeft(50); printf("12.软卧下铺全程票价:"); scanf("%f",&p->softLwr);printf("\n");} if(option == 14) {setLeft(50); printf("13.软卧上铺全程票价:"); scanf("%f",&p->softUpper);printf("\n");} if(option == 15) {setLeft(50); printf("14.硬座全程票价:"); scanf("%f",&p->hardSit);printf("\n");} if(option == 16) {setLeft(50); printf("15.余票车次数量:"); scanf("%d",&p->leftTicket);printf("\n");} Write(3,0,p->stopId); } } void delete_stop_inf() { int option; system("cls"); lists(31,1,true); setLeft(50); printf("输入0返回主菜单\n"); option = Scanf(50,0); if(option ==0) return; Write(3,option,"del"); } void simple_list(int type) { int option; if(type==1) { system("cls"); //车次列表 lists(1,1,true); setLeft(50); printf("Tip:输入0退出系统,输入1返回上一级菜单,输入2返回主菜单.\n"); option = Scanf(50,0); if(option == 0) exit(0); if(option == 1) showMenu(6); if(option == 2) showMenu(0); } else if(type==2) { system("cls"); //经停站列表 lists(2,1,true); setLeft(50); printf("Tip:输入0退出系统,输入1返回上一级菜单,输入2返回主菜单.\n"); option = Scanf(50,0); if(option == 0) exit(0); if(option == 1) showMenu(6); if(option == 2) showMenu(0); } else if(type == 3) { system("cls"); //车站信息列表 lists(31,1,true); setLeft(50); printf("Tip:输入0退出系统,输入1返回上一级菜单,输入2返回主菜单.\n"); option = Scanf(50,0); if(option == 0) exit(0); if(option == 1) showMenu(6); if(option == 2) showMenu(0); } } void tongji() { system("cls"); setTop(10); setLeft(50);printf("高速动车的车次总数:%d\n\n",getLength(1)); setLeft(50);printf("动车的车次总数:%d\n\n",getLength(4)); setLeft(50);printf("直达特快的车次总数:%d\n\n",getLength(5)); setLeft(50);printf("余票车次数量为0的车站数:%d\n\n",getLength(6)); setLeft(50);printf("有余票的车次数:%d\n\n",getLength(7)); } void sigle(int i) { int option; char str[20]; system("cls"); char *title[]={"指定车次的始发站","指定车次的始发时间","指定车次的终到站","指定车次的全程运行时间","指定车次的全程运行里程", "指定车次的硬卧下铺票价","查询某车次某经停车站的到站时间","查询指定车次中指定经停车站中的指定经停车次的相关信息", "指定时间发车数量为前三名的车站名称","返回上一级菜单","退出系统",""}; drawMenu(title,50,10,2,true); option = Scanf(50,0); if(option == 1) FScanf(1); else if(option == 2) FScanf(2); else if(option == 3) FScanf(3); else if(option == 4) FScanf(4); else if(option == 5) FScanf(5); else if(option == 6) FScanf(6); else if(option == 7) FScanf(7); else if(option == 8) { system("cls"); setTop(10); printf("请输入:"); scanf("%s",strs); p11 =findTrain(10,strs,8); findTrain(10,strs,-8); p22=findStop(-1,p11->trainId); p33=findStopInf(10,p22->stationId); lists(31,-1,false ); p33 = NULL ; } else if(option ==9) FScanf(9); else if(option ==10) showMenu(3); else if(option ==11) exit(0); } int FScanf(int n) { system("cls"); setTop(10); printf("请输入:"); scanf("%s",strs); findTrain(10,strs,n); return 0; }
-
列车时刻管理系统C语言程序设计(源代码).pdf
2021-05-20 08:44:00一、问题分析随着社会的不断发展,人们在交通方式的选择上有了不同以往的选择,以前的靠人力,畜力,以及摩托车,现在人们的选择更多的会放在了汽车...而本课题的列车时刻管理系统也应用与这些地方,不过由于专业知...一、问题分析
随着社会的不断发展,人们在交通方式的选择上有了不同以往的选择,以前的靠人力,
畜力,以及摩托车,现在人们的选择更多的会放在了汽车,飞机还有列车上。每当春节前后
时,都有一批民工潮,学生潮,这些农民工和学生都来自于祖国的各个地方,因此车站如何
合理有序的安排列车出站到站时间成了一个很关键的内容,有助于维持车站的秩序以及减少
不必要的等待。而本课题的列车时刻管理系统也应用与这些地方,不过由于专业知识学的还
不多,因此还不能将一个完整的列车时刻管理系统完全的展示出来,只是在最基础的层面上
做了一些工作。
二、系统功能设计
1.添加新记录:
利用结构数组的方式来添加新记录,并且保存在文件train.txt 文件中,并且记录上限为300,
新纪录的内容包括:出站地址,出站的时刻(时),出站时刻(分),到站地址,到站时刻(时),
到站时刻 (分)。
2.查看:
查询功能总共分为四种方式:①按出站地址查询②按出站时刻查询③按到站地址查询
④按到站时刻查询,这个功能由于能力有限,只限查找单一数据。
3.修改:
修改功能:根据出站的地址,查找出对应的一组数据的内容,然后逐一修改。
4.删除:
修改功能总共分为两个部分:①单一删除 (按照出站地址)②全部删除
5.保存:
每执行一个任务后程序会自动将数据写入train.txt 文档中。
三、模块 (函数)划分
voidmain():主函数
voidMainMenu():主菜单列表
void ShowMenu():查询菜单列表
voidAddNew():添加新的数据
int IsLoop():循环输入数据
voidDisplay():输出所有的函数
void Search_ccity():按出站地址查询
void Search_dcity():按到站地址查询
void Search_ctime():按出站时刻查询
void Search_dtime():按到站时刻查询
voidChkData(charcity1[],charcity2[],int hour1,int minute1,int hour2,int minute2):
数据检测
voidRecord_Modify():修改数据
voidDeleteMenu():删除菜单列表
voidDeleteOne():删除一组数据
voidDeleteAll():删除所有数据
voidReadFromFile():从文件中读入
voidWriteToFile():从文件中写入
列车时刻管理系统
四、模块的算法设计 (部分主要函数的代码)
1.整体构造:
主菜单
添加数据 查询数据 修改数据 删除数据
按 按 按 按
出 出 到 到
站 站 站 站 单 全
地 时 地 时 一 部
址 刻 址 刻 删 删
查 查 查 查 除 除
询 询 询 询
2.结构体:
structRecord
{
int hour1;
int hour2;
int minute1;
int minute2;
charcity1[20];
charcity2[20];
};
3.主菜单:
voidMainMenu()
{
-
数据结构列车时刻表管理系统
2018-04-20 11:33:01数据结构上机作业,链表写列车时刻表管理系统,cpp文件 -
华中科技大学 C语言课程设计 --列车时刻表信息管理系统
2018-04-24 09:19:11设计题目:列车时刻表信息管理系统 设计目的 1.巩固和加深学生对C语言课程的基本知识的理解和掌握; 2.掌握C语言编程和程序调试的基本技能; 3.利用C语言进行基本的软件设计; 4.掌握书写程序设计说明文档的... -
列车时刻管理系统c语言程序设计(源代码).doc
2021-05-20 08:45:02列车时刻管理系统c语言程序设计(源代码).doc 1、问题分析随着社会的不断发展,人们在交通方式的选择上有了不同以往的选择,以前的靠人力,畜力,以及摩托车,现在人们的选择更多的会放在了汽车,飞机还有列车上。...列车时刻管理系统c语言程序设计(源代码).doc
1、问题分析随着社会的不断发展,人们在交通方式的选择上有了不同以往的选择,以前的靠人力,畜力,以及摩托车,现在人们的选择更多的会放在了汽车,飞机还有列车上。每当春节前后时,都有一批民工潮,学生潮,这些农民工和学生都来自于祖国的各个地方,因此车站如何合理有序的安排列车出站到站时间成了一个很关键的内容,有助于维持车站的秩序以及减少不必要的等待。而本课题的列车时刻管理系统也应用与这些地方,不过由于专业知识学的还不多,因此还不能将一个完整的列车时刻管理系统完全的展示出来,只是在最基础的层面上做了一些工作。2、系统功能设计1.添加新记录:利用结构数组的方式来添加新记录,并且保存在文件train.txt文件中,并且记录上限为300,新纪录的内容包括:出站地址,出站的时刻(时),出站时刻(分),到站地址,到站时刻(时),到站时刻(分)。2.查看:查询功能总共分为四种方式:①按出站地址查询②按出站时刻查询③按到站地址查询④按到站时刻查询,这个功能由于能力有限,只限查找单一数据。3.修改:修改功能:根据出站的地址,查找出对应的一组数据的内容,然后逐一修改。4.删除:修改功能总共分为两个部分:①单一删除(按照出站地址)②全部删除5.保存:每执行一个任务后程序会自动将数据写入train.txt文档中。3、模块(函数)划分voidmain():主函数voidMainMenu():主菜单列表voidShowMenu():查询菜单列表voidAddNew():添加新的数据intIsLoop():循环输入数据voidDisplay():输出所有的函数voidSearch_ccity():按出站地址查询voidSearch_dcity():按到站地址查询voidSearch_ctime():按出站时刻查询voidSearch_dtime():按到站时刻查询voidChkData(charcity1[],charcity2[],inthour1,intminute1,inthour2,intminute2):数据检测voidRecord_Modify():修改数据voidDeleteMenu():删除菜单列表voidDeleteOne():删除一组数据voidDeleteAll():删除所有数据voidReadFromFile():从文件中读入voidWriteToFile():从文件中写入列车时刻管理系统24、模块的算法设计(部分主要函数的代码)1.整体构造:2.结构体:structRecord{inthour1;inthour2;intminute1;intminute2;charcity1[20];charcity2[20];};3.主菜单:voidMainMenu(){system(“cls“);printf(“------------------------主菜单-----------------------------\n“);intoption;printf(“---------------------1-添加新记录--------------------------\n“);printf(“---------------------2-查看--------------------------------\n“);printf(“---------------------3-修改--------------------------------\n“);printf(“---------------------4-删除--------------------------------\n“);printf(“---------------------5-退出程序----------------------------\n“);printf(“请选择:\n“);scanf(“%d“,getchar();switch(option)主菜单查询数据添加数据修改数据删除数据按出站地址查询按出站时刻查询按到站时刻查询按到站地址查询全部删除单一删除列车时刻管理系统3{case1:AddNew();break;case2:ShowMenu();break;case3:Record_Modify();break;case4:DeleteMenu();break;case5:exit(0);}}4.数据检测:voidChkData(charcity1[],charcity2[],inthour1,intminute1,inthour2,intminute2){if(strlen(city1)>20){printf(“出站地址的字符不能超过20个!\n“);MainMenu();}if(strlen(city2)>20){printf(“到站地址不能超过20位!\n“);MainMenu();}if(hour123){printf(“时刻输入错误(024){printf(“时刻输入错误(059){printf(“时刻输入错误(059){printf(“时刻输入错误(0#include#include#include#include#includestructRecord/***定义结构体******/{inthour1;inthour2;intminute1;intminute2;charcity1[20];charcity2[20];};structRecordRecords[300];/****数组的成员个数限制了数据的数量要小于300****/intnum=0;voidAddNew();intIsLoop();voidDisplay();voidShowMenu();voidSearch_ccity();voidSearch_dcity();voidSearch_ctime();voidSearch_dtime();voidChkData(charcity1[],charcity2[],inthour1,intminute1,inthour2,intminute2);voidRecord_Modify();voidDeleteMenu();voidDeleteAll();voidDeleteOne();voidReadFromFile();voidMainMenu();voidWriteToFile();voidmain()/***主函数********/{ReadFromFile();/***读取文件中的数据****/getchar();while(1){MainMenu();WriteToFile();/*******将数据写入文件中****/}}列车时刻管理系统8/******从文件读取记录*******/voidReadFromFile(){FILE*fp;inti;if((fp=(“train.txt“,“rb“))==NULL){printf(“列车时刻信息不存在,请按回车重新建立!\n“);return;}elseprintf(“列车信息存在,请按回车键选择操作“);if(fread(}else{for(
-
列车时刻管理系统C语言程序设计(源代码).doc
2021-05-20 08:44:58列车时刻管理系统C语言程序设计(源代码)问题分析随着社会的不断发展,人们在交通方式的选择上有了不同以往的选择,以前的靠人力,畜力,以及摩托车,现在人们的选择更多的会放在了汽车,飞机还有列车上。每当春节... -
终稿火车订票系统的设计与实现课程设计.doc最终版(范文1)
2021-05-20 14:32:00《火车订票系统的设计与实现课程设计.doc》由会员分享,可免费在线阅读全文,更多与《(终稿)火车订票系统的设计与实现课程设计.doc(最终版)》相关文档资源请在帮帮文库(www.woc88.com)数亿文档库存里搜索。... -
列车时刻管理系统C语言程序设计(源代码)(22页)-原创力文档
2021-05-20 08:45:33问题分析随着社会的不断发展,人们在交通方式的选择上有了不同以往的选择,以前的靠人力,畜力,以及摩托车,现在人们的选择更多的会放在了汽车...而本课题的列车时刻管理系统也应用与这些地方,不过由于专业知识学... -
c语言列车时刻表管理系统,有大神做过或者会做的么?。。。
2021-05-23 08:30:46#include using namespace std; class Time { private: int hour,minute,second; public: Time(int ihour,int ...也就是和列车时刻管理系统差不多 追问 我试着运行运行看看啦。 温馨提示:答案为网友推荐,仅供参考 -
火车票完整系统(C语言)【报告版带截图】.doc
2021-05-21 11:32:39火车票完整系统(C语言)【报告版带截图】课题内容和要求设计目标:设计一个火车票务管理系统,用C语言实现。对该系统的要求如下:需求描述:1.系统功能(1)火车时刻信息录入。包括车次、日期、起点、终点、开车时间、... -
基于C语言实现简单的12306火车售票系统.pdf
2021-05-20 17:20:24基基于于C语语言言实实现现简简单单的的12306火火车车售售票票系系统统程序设计要求用C语言写一个简单的火车售票系统,主要实现的功能为:入班次信息浏览班次信息按班次号查询按终点站查询按余票数量排序保存售票... -
《C语言》课程设计——火车票信息管理系统
2021-03-29 21:58:24《C语言》课程设计——火车票信息管理系统一、课题功能描述二、基本原理 一、课题功能描述 本课题要求设计一个火车票信息管理系统,主要包括火车时刻信息的录入、火车票查询、统计、排序的功能。火车票信息管理系统... -
C++语言 列车查询系统
2020-07-10 13:04:42C语言 列车查询系统 #include<iostream> #include<fstream> #include<string> #include<string.h> using namespace std; template<class T> struct Node //列车链表的结点 { T data;... -
全国交通模拟_C语言_全国交通模拟_
2021-09-29 04:00:27(1)提供对城市信息进行编辑(如添加或删除)的...列车时刻表需根据交通图给出各个路段的详细信息,如:对从北京到上海的火车,需给出北京至天津、天津至徐州以及徐州至上海各段的出发时间、到达时间及票价等信息。 -
利用WebService制作简易的列车时刻表
2012-09-12 14:26:00火车列车时刻表webservice:http://www.webxml.com.cn/WebServices/TrainTimeWebService.asmx 前台代码: 前台代码 1 <body> 2 <form id="form1" runat="server"&... -
极品公交(全国)时刻表
2010-03-15 13:11:44[极品列车时刻表/极品公交时刻表]是一款查询全国列车时刻表的单机版软件,它的运行不需要网络支持,并具有以下特点: ·最新的数据 -- 极高的数据更新频率! [列车升级历史..] ·最快的速度 -- 无与伦比的执行... -
C语言课程设计-火车票务系统
2018-09-22 23:20:01学习过C语言之后,第一次完成这样较大规模的程序,程序仍有许多不完美的地方。 该火车票务系统有两个操作身份可供选择:管理员和乘客。管理员有更新、添加、删除、修改列车信息以及指定可休假车长的功能;乘客可以... -
列车时刻查询程序
2012-12-12 10:13:51基于C语言开发的列车时刻表查询系统,内含报告,程序完整可运行。 -
详解C语言进程同步机制
2021-05-19 14:58:51对于上面的问题,大家想一想这么一个场景,如果我们在买火车票(just for 举栗子)时,没有排队这个机制,大家乱糟糟的围在售票员旁边,手里举着钱大叫来一张到xxx的硬座、来张到xxx的卧铺。。。咦,不寒而栗、可怕... -
火车票务管理系统(C语言版)【TXT文件,改后缀即可】
2021-05-23 04:56:27大一的时候做的程序设计,好用!将文本下载后后缀改为“.c”就能使用。带注释,有刷屏功能,一点也不乱。【原创哦!】 /* 头文件 */ #include #include #include /* 函数声明 */ int MENU()...录入火车时刻信息\n"); printf -
C语言交通咨询系统
2021-12-16 21:28:59C语言交通咨询系统 2.1 问题描述 设计一个交通咨询系统,能让旅客咨询从任一个城市顶点到另一个城市顶点之间的最短...(2)对城市间的两种交通工具(飞机航班和列车时刻表)进行编辑:里程、航班和列车班次的添加、修 -
实验报告C语言数据结构全国交通模拟咨询.doc
2021-02-01 01:20:08浙江工商大学计算机与信息工程学院数据结构实验大作业报告专 业: 物流1001班 级: 1001学 号: 1012600118姓 名: 金渐指导教师: 庄毅2011年12月8日一、问题描述处于对不同目的的旅客对交通工具有不同的要求。... -
火车车次查询系统——时间最短,价格最优(非空双向循环链表)C语言Linux实训作业
2020-02-12 10:07:10huoche.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include "huoche.h" #define MAX 10001000 LLIST *p_checi=NULL; char from[40]; char arrive[40];...int... -
C++火车入轨算法的实现代码
2021-01-17 12:47:38【问题描述】某城市有一个火车站,铁轨铺设如图所示。有n节车厢从A方向驶入车站,按进站顺序编号为1~n。你的任务是让它们按照某种特定的顺序进入B方向的铁轨并驶出车站。为了重组车厢,你可以借助中转站C。这是一个... -
单链表学习笔记(C语言建立链表)
2021-12-11 20:44:05如果将链表比作一节列车,车厢就是数据,车厢与车厢之间连接的钩锁就是next指向的地址 链表的构建的关键在与利用结构体在储存数据的同时用指针记录下一个结点的地址,链表构建的主要操作有结构体的建立、头结点的...