|
|
@ -277,34 +277,34 @@ void charu()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void save()
|
|
|
|
void save()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FILE *fp; //定义指向文件的指针
|
|
|
|
FILE *fp;
|
|
|
|
if((fp=fopen("e:\\xiao.txt","w"))==NULL) //为输出打开一个二进制文件,为只写方式
|
|
|
|
if((fp=fopen("c:\\xiao.txt","w"))==NULL)
|
|
|
|
printf("\n保存中...Saving the file......\n");
|
|
|
|
printf("\n保存中...Saving the file......\n");
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
fprintf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
|
|
|
|
fprintf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
|
|
|
|
fclose(fp); //关闭文件
|
|
|
|
fclose(fp);
|
|
|
|
printf("保存成功....Save the file successfully!\n");
|
|
|
|
printf("保存成功....Save the file successfully!\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void read()
|
|
|
|
void read()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FILE *fp;//定义指向文件的指针
|
|
|
|
FILE *fp;
|
|
|
|
if((fp=fopen("e:\\xiao.txt","r"))==NULL) //为输出打开一个二进制文件,为只写方式
|
|
|
|
if((fp=fopen("c:\\xiao.txt","r"))==NULL)
|
|
|
|
fscanf(fp,"运动员号码,姓名,100成绩,铅球成绩,跳高成绩,跳远成绩,系名:\n");
|
|
|
|
fscanf(fp,"运动员号码,姓名,100成绩,铅球成绩,跳高成绩,跳远成绩,系名:\n");
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
for(int i=0;i<size;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fscanf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%s\n",&stu[i].num,&stu[i].name,&stu[i].scorem,&stu[i].scoreq,&stu[i].scoreg,&stu[i].scorey,&stu[i].ximing);
|
|
|
|
fscanf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%s\n",&stu[i].num,&stu[i].name,&stu[i].scorem,&stu[i].scoreq,&stu[i].scoreg,&stu[i].scorey,&stu[i].ximing);
|
|
|
|
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
|
|
|
|
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(fp); //关闭文件
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void menu()
|
|
|
|
void menu()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int ch1;
|
|
|
|
int ch1;
|
|
|
|
char ch2;
|
|
|
|
char ch2;
|
|
|
|
struct tm *pt; /*定义时间结构体*/
|
|
|
|
struct tm *pt;
|
|
|
|
time_t t;
|
|
|
|
time_t t;
|
|
|
|
t=time(NULL);
|
|
|
|
t=time(NULL);
|
|
|
|
pt=localtime(&t); /*读取系统日期并把它放到结构体中*/
|
|
|
|
pt=localtime(&t);
|
|
|
|
do{
|
|
|
|
do{
|
|
|
|
printf("\t\t当前系统日期:%d-%d-%d\n",pt->tm_year+1900,pt->tm_mon+1,pt->tm_mday);
|
|
|
|
printf("\t\t当前系统日期:%d-%d-%d\n",pt->tm_year+1900,pt->tm_mon+1,pt->tm_mday);
|
|
|
|
printf("======================菜单=====================\n");
|
|
|
|
printf("======================菜单=====================\n");
|
|
|
@ -361,6 +361,5 @@ void menu()
|
|
|
|
int main(void)
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
system("color f");
|
|
|
|
system("color f");
|
|
|
|
//Logon();
|
|
|
|
|
|
|
|
menu();
|
|
|
|
menu();
|
|
|
|
}
|
|
|
|
}
|