diff --git a/3.c b/4.c similarity index 96% rename from 3.c rename to 4.c index e7feb12..5f46268 100644 --- a/3.c +++ b/4.c @@ -33,7 +33,7 @@ void credit(int n) printf("请输入用于存放文件的路径及路径名:"); scanf("%s",fpname); getchar(); - fp=fopen(fpname,"w+"); + fp=fopen(fpname,"a+"); head=(struct student *)malloc(sizeof(struct student)); printf("请输入学生学号 姓名 性别 出生年 月 日 地址 电话 e_mail:"); scanf("%d %s %c %d %d %d %s %s %s",&head->number,head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); @@ -67,9 +67,9 @@ int show2(int n) for(i=0;inumber,head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); - printf("%d %s %c %d %d %d %s %s %s",head->number,head->name,head->sex,(*head).birthday.year,(*head).birthday.month,(*head).birthday.day,head->address,head->tel,head->E_mail); - fclose(fp); + printf("%d %s %c %d %d %d %s %s %s",&head->number,head->name,head->sex,(*head).birthday.year,(*head).birthday.month,(*head).birthday.day,head->address,head->tel,head->E_mail); } + fclose(fp); } int search1(int n) { @@ -114,7 +114,6 @@ int search2(int n) fscanf(fp,"%d %s %c %d %d %d %s %s %s",&head->number,head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); if(strcmp(checkname,head->name)==0) { - for(i=0;inumber,head->name,head->sex,(*head).birthday.year,(*head).birthday.month,(*head).birthday.day,head->address,head->tel,head->E_mail); fclose(fp); return(1); diff --git a/3.exe b/4.exe similarity index 75% rename from 3.exe rename to 4.exe index a398488..e934f6f 100644 Binary files a/3.exe and b/4.exe differ