优化代码 去除无用项

master
ithg 7 years ago
parent 4de6c07d9d
commit 676e56c8f4

@ -146,6 +146,8 @@ void Save() //
Menu();
}
printf("数据保存中,请稍后\n");
fp2 = fopen("num.txt", "wb");
fp1 = fopen("sql.txt", "wb");
fwrite(&class_num, sizeof(int), 1, fp2); //写入文件信息
fwrite(records, sizeof(CLASS), class_num, fp1);
fclose(fp1);
@ -168,6 +170,8 @@ void Load() //
system("pause");
Menu();
}
fp1 = fopen("sql.txt", "rb");
fp2 = fopen("num.txt", "rb");
fread(&class_num, sizeof(int), 1, fp2); //读入信息
fread(records, sizeof(CLASS), class_num, fp1); //读入信息
fclose(fp1);
@ -176,7 +180,8 @@ void Load() //
int Judge(int i) //判断时间是否超出
{
struct tm *local; //时间结构体
time_t t; //把当前时间给t
time_t t;
time(&t);
local = localtime(&t); //获取当前系统时间
if (local->tm_hour < atoi(records[i].hour) || local->tm_hour == atoi(records[i].hour) && local->tm_min < atoi(records[i].min))
//atoi函数将字符串转换成一个整数值
@ -205,7 +210,6 @@ int FindCarByNum(char s1[]) //
void Import()
{
int i = 0, j = 5, h;
char s[5];
FILE *fp;
system("cls");
if ((fp = fopen("num.txt", "rb")) != NULL)

Loading…
Cancel
Save