火车站售票查询系统 C语言 源代码
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
TRAIN {
char start_site[20]; /*始发站*/ char end_site[20];/*终点站*/ char go_time[6]; /*出发时间*/ char end_time[6]; /*到达时间*/ }all[200]={ "Delphinium","Oopcentral","0810","1118",\ "Delphinium","Seatown" ,"0814","1023",\ "Delphinium" ,"Seatown" ,"0938", "1152",\ "Delphinium" ,"Seatown" ,"1015", "1225",\ "Delphinium" ,"Seatown" ,"1115", "1321",\ "Delphinium" ,"Seatown" ,"1236", "1439",\ "Delphinium" ,"Teakall" ,"0825", "0923",\ "Delphinium" ,"Teakall" ,"0925", "1023",\ "Delphinium" ,"Teakall" ,"1025", "1123",\ "Delphinium" ,"Teakall" ,"1125", "1223",\ "Delphinium" ,"Teakall" ,"1225", "1323",\ "Delphinium" ,"Teakall" ,"1325", "1423",\ "Delphinium" ,"Teakall" ,"1425", "1523",\ "Delphinium" ,"Teakall" ,"1525", "1623",\ "Javaville" ,"Seatown" ,"0830", "0955",\ "Javaville" ,"Seatown" ,"1013", "1140",\ "Javaville" ,"Seatown" ,"1114", "1240",\ "Javaville" ,"Seatown" ,"1210", "1340",\ "Javaville" ,"Seatown" ,"1314", "1440",\ "Javaville" ,"Seatown" ,"1412", "1542",\ "Javaville" ,"Teakall" ,"0926", "1302",\ "Javaville" ,"Teakall" ,"1118", "1436",\ "Javaville" ,"Teakall" ,"1256", "1616",\ "Javaville" ,"Teakall" ,"1535", "1902",\ "Oopcentral" ,"Delphinium" ,"0840", "1141",\ "Oopcentral" ,"Seatown" ,"0810", "1321",\ "Oopcentral" ,"Seatown" ,"0910", "1349",\ "Oopcentral" ,"Seatown" ,"0940", "1500",\ "Oopcentral" ,"Seatown" ,"1155", "1653",\ "Oopcentral" ,"Seatown" ,"1440", "1919",\ "Oopcentral" ,"Teakall" ,"1040", "1412",\ "Oopcentral" ,"Teakall" ,"1155", "1515",\ "Perlston" ,"Seatown" ,"0819", "0913",\ "Perlston" ,"Seatown" ,"0919", "1013",\ "Perlston" ,"Seatown" ,"1019", "1113",\ "Perlston" ,"Seatown" ,"1119", "1213",\ "Perlston" ,"Seatown" ,"1219", "1313",\ "Perlston" ,"Seatown" ,"1319", "1413",\ "Perlston" ,"Seatown" ,"1419", "1513",\
2
};
void _time_to_2_numbers(char a[6],int *p1,int *p2) /*字符串---- 数字,指针带回小时和分钟两个整*/
{
int t11,t12,t21,t22;
t11=a[0]-48; /*将'2'*字符转换为数字2*/
t12=a[1]-48;
*p1=t11*10+t12; /*t1:前两位*/
/*站点集合*/
char my_start_site[20]=""; /*输入的始发站*/
char my_end_site[20]=""; /*输入的终点站*/
char my_end_time[6]=""; /*输入的到达时间*/
int all_length=0;
void _duration(char time1[6],char time2[6],char duration_time[6])
_time_to_2_numbers(time2,n1,n2); /*得到m1,m2 第二个时间的小时¡分钟*/
d1=m1-f1; /*小时的差值*/
if (m2>=f2)
d2=m2-f2; /*分钟的差值*/
else
{
d2=m2+60-f2;
d1=d1-1;
}
duration_time[0]='0'; duration_time[1]=d1+48; duration_time[2]=d2/10+48; duration_time[3]=d2%10+48; duration_time[4]='\0'; }
1
"Seatown" ,"Delphinium" ,"0845", "1046",\ "Seatown" ,"Delphinium" ,"1045", "1246",\ "Seatown" ,"Delphinium" ,"1145", "1347",\ "Seatown" ,"Delphinium" ,"1245", "1447",\ "Seatown" ,"Delphinium" ,"1445", "1647",\ "Seatown" ,"Javaville" ,"0830", "1007",\ "Seatown" ,"Javaville" ,"0930", "1107",\ "Seatown" ,"Javaville" ,"1000", "1136",\ "Seatown" ,"Javaville" ,"1039", "1155",\ "Seatown" ,"Javaville" ,"1100", "1231",\ "Seatown" ,"Javaville" ,"1230", "1354",\ "Seatown" ,"Javaville" ,"1330", "1453",\ "Seatown" ,"Javaville" ,"1509", "1642",\ "Seatown" ,"Oopcentral" ,"0905", "1338",\ "Seatown" ,"Oopcentral" ,"1104", "1532",\ "Seatown" ,"Oopcentral" ,"1334", "1909",\ "Seatown" ,"Oopcentral" ,"1445", "1956",\ "Seatown" ,"Perlston" ,"0836", "0930",\ "Seatown" ,"Perlston" ,"0936", "1030",\ "Seatown" ,"Perlston" ,"1036", "1130",\ "Seatown" ,"Perlston" ,"1136", "1230",\ "Seatown" ,"Perlston" ,"1236", "1330",\ "Seatown" ,"Perlston" ,"1336", "1430",\ "Seatown" ,"Perlston" ,"1436", "1530",\ "Seatown" ,"Teakall" ,"0800", "0945",\ "Seatown" ,"Teakall" ,"0835", "1017",\ "Seatown" ,"Teakall" ,"0934", "1120",\ "Seatown" ,"Teakall" ,"1034", "1216",\ "Seatown" ,"Teakall" ,"1107", "1302",\ "Seatown" ,"Teakall" ,"1134", "1326",\ "Seatown" ,"Teakall" ,"1234", "1417",\ "Seatown" ,"Teakall" ,"1334", "1519",\ "Seatown" ,"Teakall" ,"1434", "1616",\ "Teakall" ,"Delphinium" ,"0833", "0933",\ "Teakall" ,"Delphinium" ,"0933", "1033",\ "Teakall" ,"Delphinium" ,"1033", "1133",\ "Teakall" ,"Delphinium" ,"1133", "1233",\ "Teakall" ,"Delphinium" ,"1233", "1333",\ "Teakall" ,"Delphinium" ,"1333", "1433",\ "Teakall" ,"Delphinium" ,"1433", "1533",\ "Teakall" ,"Delphinium" ,"1533", "1633",\ "Teakall" ,"Javaville" ,"1103", "1429",\ "Teakall" ,"Javaville" ,"1115", "1445",\ "Teakall" ,"Javaville" ,"1217", "1542",\ "Teakall" ,"Javaville" ,"1517", "1846",\ "Teakall" ,"Oopcentral" ,"1307", "1628",\ "Teakall" ,"Oopcentral" ,"1522", "1909",\ "Teakall" ,"Seatown" ,"0814", "1003",\ "Teakall" ,"Seatown" ,"0914", "1100",\ "Teakall" ,"Seatown" ,"1014", "1159",\ "Teakall" ,"Seatown" ,"1115", "1303",\ "Teakall" ,"Seatown" ,"1217", "1403",\ "Teakall" ,"Seatown" ,"1314", "1451",\ "Teakall" ,"Seatown" ,"1417", "1600",\ "#","#","#","#"
Journey Planer 原始程序
#define TRAIN struct journey /*#define _CRT_SECURE_NO_DEPRECATE*/ #include <stdlib.h> #include <stdio.h> #include <tchar.h> #include <string.h> #include <conio.h>
t21=a[2]-48;
t22=a[3]-48;
*p2=t2来自百度文库*10+t22; /*t2:后两位*/
}
TRAIN my[100]; /*存放:直达直达或者不能直达时前一段车次*/
TRAIN change[100]; /*存放:转车的车次*/
char site[7][20]={"Delphinium","Javaville","Oopcentral","Perlston","Seatown","Teakall"};
/*duration _time: 时间差*/
{
int f1=0,f2=0,m1=0,m2=0;
int d1,d2;
/*算时间差用*/
int *k1=&f1,*k2=&f2,*n1=&m1,*n2=&m2;
_time_to_2_numbers(time1,k1,k2); /*得到f1,f2 第一个时间的小时,分钟*/
char start_site[20]; /*始发站*/ char end_site[20];/*终点站*/ char go_time[6]; /*出发时间*/ char end_time[6]; /*到达时间*/ }all[200]={ "Delphinium","Oopcentral","0810","1118",\ "Delphinium","Seatown" ,"0814","1023",\ "Delphinium" ,"Seatown" ,"0938", "1152",\ "Delphinium" ,"Seatown" ,"1015", "1225",\ "Delphinium" ,"Seatown" ,"1115", "1321",\ "Delphinium" ,"Seatown" ,"1236", "1439",\ "Delphinium" ,"Teakall" ,"0825", "0923",\ "Delphinium" ,"Teakall" ,"0925", "1023",\ "Delphinium" ,"Teakall" ,"1025", "1123",\ "Delphinium" ,"Teakall" ,"1125", "1223",\ "Delphinium" ,"Teakall" ,"1225", "1323",\ "Delphinium" ,"Teakall" ,"1325", "1423",\ "Delphinium" ,"Teakall" ,"1425", "1523",\ "Delphinium" ,"Teakall" ,"1525", "1623",\ "Javaville" ,"Seatown" ,"0830", "0955",\ "Javaville" ,"Seatown" ,"1013", "1140",\ "Javaville" ,"Seatown" ,"1114", "1240",\ "Javaville" ,"Seatown" ,"1210", "1340",\ "Javaville" ,"Seatown" ,"1314", "1440",\ "Javaville" ,"Seatown" ,"1412", "1542",\ "Javaville" ,"Teakall" ,"0926", "1302",\ "Javaville" ,"Teakall" ,"1118", "1436",\ "Javaville" ,"Teakall" ,"1256", "1616",\ "Javaville" ,"Teakall" ,"1535", "1902",\ "Oopcentral" ,"Delphinium" ,"0840", "1141",\ "Oopcentral" ,"Seatown" ,"0810", "1321",\ "Oopcentral" ,"Seatown" ,"0910", "1349",\ "Oopcentral" ,"Seatown" ,"0940", "1500",\ "Oopcentral" ,"Seatown" ,"1155", "1653",\ "Oopcentral" ,"Seatown" ,"1440", "1919",\ "Oopcentral" ,"Teakall" ,"1040", "1412",\ "Oopcentral" ,"Teakall" ,"1155", "1515",\ "Perlston" ,"Seatown" ,"0819", "0913",\ "Perlston" ,"Seatown" ,"0919", "1013",\ "Perlston" ,"Seatown" ,"1019", "1113",\ "Perlston" ,"Seatown" ,"1119", "1213",\ "Perlston" ,"Seatown" ,"1219", "1313",\ "Perlston" ,"Seatown" ,"1319", "1413",\ "Perlston" ,"Seatown" ,"1419", "1513",\
2
};
void _time_to_2_numbers(char a[6],int *p1,int *p2) /*字符串---- 数字,指针带回小时和分钟两个整*/
{
int t11,t12,t21,t22;
t11=a[0]-48; /*将'2'*字符转换为数字2*/
t12=a[1]-48;
*p1=t11*10+t12; /*t1:前两位*/
/*站点集合*/
char my_start_site[20]=""; /*输入的始发站*/
char my_end_site[20]=""; /*输入的终点站*/
char my_end_time[6]=""; /*输入的到达时间*/
int all_length=0;
void _duration(char time1[6],char time2[6],char duration_time[6])
_time_to_2_numbers(time2,n1,n2); /*得到m1,m2 第二个时间的小时¡分钟*/
d1=m1-f1; /*小时的差值*/
if (m2>=f2)
d2=m2-f2; /*分钟的差值*/
else
{
d2=m2+60-f2;
d1=d1-1;
}
duration_time[0]='0'; duration_time[1]=d1+48; duration_time[2]=d2/10+48; duration_time[3]=d2%10+48; duration_time[4]='\0'; }
1
"Seatown" ,"Delphinium" ,"0845", "1046",\ "Seatown" ,"Delphinium" ,"1045", "1246",\ "Seatown" ,"Delphinium" ,"1145", "1347",\ "Seatown" ,"Delphinium" ,"1245", "1447",\ "Seatown" ,"Delphinium" ,"1445", "1647",\ "Seatown" ,"Javaville" ,"0830", "1007",\ "Seatown" ,"Javaville" ,"0930", "1107",\ "Seatown" ,"Javaville" ,"1000", "1136",\ "Seatown" ,"Javaville" ,"1039", "1155",\ "Seatown" ,"Javaville" ,"1100", "1231",\ "Seatown" ,"Javaville" ,"1230", "1354",\ "Seatown" ,"Javaville" ,"1330", "1453",\ "Seatown" ,"Javaville" ,"1509", "1642",\ "Seatown" ,"Oopcentral" ,"0905", "1338",\ "Seatown" ,"Oopcentral" ,"1104", "1532",\ "Seatown" ,"Oopcentral" ,"1334", "1909",\ "Seatown" ,"Oopcentral" ,"1445", "1956",\ "Seatown" ,"Perlston" ,"0836", "0930",\ "Seatown" ,"Perlston" ,"0936", "1030",\ "Seatown" ,"Perlston" ,"1036", "1130",\ "Seatown" ,"Perlston" ,"1136", "1230",\ "Seatown" ,"Perlston" ,"1236", "1330",\ "Seatown" ,"Perlston" ,"1336", "1430",\ "Seatown" ,"Perlston" ,"1436", "1530",\ "Seatown" ,"Teakall" ,"0800", "0945",\ "Seatown" ,"Teakall" ,"0835", "1017",\ "Seatown" ,"Teakall" ,"0934", "1120",\ "Seatown" ,"Teakall" ,"1034", "1216",\ "Seatown" ,"Teakall" ,"1107", "1302",\ "Seatown" ,"Teakall" ,"1134", "1326",\ "Seatown" ,"Teakall" ,"1234", "1417",\ "Seatown" ,"Teakall" ,"1334", "1519",\ "Seatown" ,"Teakall" ,"1434", "1616",\ "Teakall" ,"Delphinium" ,"0833", "0933",\ "Teakall" ,"Delphinium" ,"0933", "1033",\ "Teakall" ,"Delphinium" ,"1033", "1133",\ "Teakall" ,"Delphinium" ,"1133", "1233",\ "Teakall" ,"Delphinium" ,"1233", "1333",\ "Teakall" ,"Delphinium" ,"1333", "1433",\ "Teakall" ,"Delphinium" ,"1433", "1533",\ "Teakall" ,"Delphinium" ,"1533", "1633",\ "Teakall" ,"Javaville" ,"1103", "1429",\ "Teakall" ,"Javaville" ,"1115", "1445",\ "Teakall" ,"Javaville" ,"1217", "1542",\ "Teakall" ,"Javaville" ,"1517", "1846",\ "Teakall" ,"Oopcentral" ,"1307", "1628",\ "Teakall" ,"Oopcentral" ,"1522", "1909",\ "Teakall" ,"Seatown" ,"0814", "1003",\ "Teakall" ,"Seatown" ,"0914", "1100",\ "Teakall" ,"Seatown" ,"1014", "1159",\ "Teakall" ,"Seatown" ,"1115", "1303",\ "Teakall" ,"Seatown" ,"1217", "1403",\ "Teakall" ,"Seatown" ,"1314", "1451",\ "Teakall" ,"Seatown" ,"1417", "1600",\ "#","#","#","#"
Journey Planer 原始程序
#define TRAIN struct journey /*#define _CRT_SECURE_NO_DEPRECATE*/ #include <stdlib.h> #include <stdio.h> #include <tchar.h> #include <string.h> #include <conio.h>
t21=a[2]-48;
t22=a[3]-48;
*p2=t2来自百度文库*10+t22; /*t2:后两位*/
}
TRAIN my[100]; /*存放:直达直达或者不能直达时前一段车次*/
TRAIN change[100]; /*存放:转车的车次*/
char site[7][20]={"Delphinium","Javaville","Oopcentral","Perlston","Seatown","Teakall"};
/*duration _time: 时间差*/
{
int f1=0,f2=0,m1=0,m2=0;
int d1,d2;
/*算时间差用*/
int *k1=&f1,*k2=&f2,*n1=&m1,*n2=&m2;
_time_to_2_numbers(time1,k1,k2); /*得到f1,f2 第一个时间的小时,分钟*/