尝试去除对conio库的依赖

dev
ithg 6 years ago
parent 22cd5bfa2d
commit f7aac9cfd4

32
sms.c

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

Loading…
Cancel
Save