|
|
@ -3,7 +3,7 @@
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h> //时间库函数
|
|
|
|
#include <time.h> //时间库函数
|
|
|
|
#include <conio.h> //输入输出库
|
|
|
|
//#include <conio.h> //输入输出库
|
|
|
|
|
|
|
|
|
|
|
|
int class_num = 0; //初始班次总数为0
|
|
|
|
int class_num = 0; //初始班次总数为0
|
|
|
|
|
|
|
|
|
|
|
@ -108,7 +108,7 @@ void Scanf(int i, int j) //
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("输入错误!\n");
|
|
|
|
printf("输入错误!\n");
|
|
|
|
_getch(); //使达到按下任意键返回的作用 在新版c标准中要使用_getch();
|
|
|
|
system("pause"); //使达到按下任意键返回的作用 在新版c标准中要使用system("pause");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("请输入起点站:\n");
|
|
|
|
printf("请输入起点站:\n");
|
|
|
@ -128,7 +128,7 @@ void Scanf(int i, int j) //
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("输入错误!\n");
|
|
|
|
printf("输入错误!\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -158,14 +158,14 @@ void Load() //
|
|
|
|
{
|
|
|
|
{
|
|
|
|
system("cls");
|
|
|
|
system("cls");
|
|
|
|
printf("车次数据文件不存在\n");
|
|
|
|
printf("车次数据文件不存在\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
exit(0);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((fp2 = fopen("num.txt", "rb+")) == NULL)
|
|
|
|
if ((fp2 = fopen("num.txt", "rb+")) == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
system("cls");
|
|
|
|
system("cls");
|
|
|
|
printf("车次序号数据文件不存在\n");
|
|
|
|
printf("车次序号数据文件不存在\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
exit(0);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fread(&class_num, sizeof(int), 1, fp2); //读入信息
|
|
|
|
fread(&class_num, sizeof(int), 1, fp2); //读入信息
|
|
|
@ -211,8 +211,7 @@ void Import()
|
|
|
|
if ((fp = fopen("num.txt", "rb")) != NULL)
|
|
|
|
if ((fp = fopen("num.txt", "rb")) != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("车次信息已经存在,请选择添加车次功能!\n");
|
|
|
|
printf("车次信息已经存在,请选择添加车次功能!\n");
|
|
|
|
printf("按下任意键,返回主菜单\n");
|
|
|
|
system("pause");
|
|
|
|
_getch();
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
i = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == 0)
|
|
|
|
if (i == 0)
|
|
|
@ -272,13 +271,13 @@ void Buy()
|
|
|
|
records[i].bought++;
|
|
|
|
records[i].bought++;
|
|
|
|
printf("通向%s班次为%s的票订票成功!\n", records[i].to, records[i].number);
|
|
|
|
printf("通向%s班次为%s的票订票成功!\n", records[i].to, records[i].number);
|
|
|
|
Save();
|
|
|
|
Save();
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("该班次已满或已发出!\n");
|
|
|
|
printf("该班次已满或已发出!\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -308,18 +307,18 @@ void Refund()
|
|
|
|
records[i].bought--;
|
|
|
|
records[i].bought--;
|
|
|
|
printf("退票成功!\n");
|
|
|
|
printf("退票成功!\n");
|
|
|
|
Save();
|
|
|
|
Save();
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("该班车已发出,无法退票!\n");
|
|
|
|
printf("该班车已发出,无法退票!\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == class_num)
|
|
|
|
if (i == class_num)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("输入错误!\n");
|
|
|
|
printf("输入错误!\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -352,8 +351,7 @@ void Query()
|
|
|
|
printf("输入错误!\n");
|
|
|
|
printf("输入错误!\n");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("按任意键继续....\n");
|
|
|
|
system("pause");
|
|
|
|
_getch();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Find(char s1[], char s2[])
|
|
|
|
void Find(char s1[], char s2[])
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -396,7 +394,7 @@ void Insert()
|
|
|
|
//判断车次是否重复
|
|
|
|
//判断车次是否重复
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("输出车次已存在!\n");
|
|
|
|
printf("输出车次已存在!\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == class_num)
|
|
|
|
if (i == class_num)
|
|
|
@ -426,8 +424,8 @@ void Exploer() //
|
|
|
|
records[i].from, records[i].to, records[i].hours, records[i].max, records[i].bought);
|
|
|
|
records[i].from, records[i].to, records[i].hours, records[i].max, records[i].bought);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ShowTableFoot();
|
|
|
|
ShowTableFoot();
|
|
|
|
printf("\n按任意键继续....\n");
|
|
|
|
printf("\n");
|
|
|
|
_getch();
|
|
|
|
system("pause");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void ShowTableHead()
|
|
|
|
void ShowTableHead()
|
|
|
|
{
|
|
|
|
{
|
|
|
|