diff --git a/2.exe b/2.exe deleted file mode 100644 index 06c1b61..0000000 Binary files a/2.exe and /dev/null differ diff --git a/2.c b/3.c similarity index 63% rename from 2.c rename to 3.c index b3a20df..e7feb12 100644 --- a/2.c +++ b/3.c @@ -36,17 +36,17 @@ void credit(int n) fp=fopen(fpname,"w+"); 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); + 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); getchar(); - fprintf(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); + fprintf(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); end=head; - for(i=0;inumber,&head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->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); getchar(); - fprintf(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); + fprintf(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); end->link=next; end=next; end->link=NULL; @@ -66,8 +66,8 @@ int show2(int n) fp=fopen(fpname,"r+"); 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); + 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); + 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); } } @@ -86,10 +86,10 @@ scanf("%d",&checkname); getchar(); for(i=0;inumber,&head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); + 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(checkname==head->number) { - printf("%d %s %c %d %d %d %s %s %s\n",&head->number,&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\n",head->number,head->name,head->sex,(*head).birthday.year,(*head).birthday.month,(*head).birthday.day,head->address,head->tel,head->E_mail); fclose(fp); return(1); } @@ -108,13 +108,14 @@ int search2(int n) fp=fopen(fpname,"r+"); printf("请输入要查询信息的学生姓名:"); scanf("%s",&checkname); + getchar(); for(i=0;inumber,&head->name,&head->sex,&(*head).birthday.year,&(*head).birthday.month,&(*head).birthday.day,head->address,head->tel,head->E_mail); + 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); + fprintf(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); fclose(fp); return(1); } @@ -133,11 +134,11 @@ int most(n) gets(fpname); fp=fopen(fpname,"r+"); ans[0]=(struct student *)malloc(sizeof(struct student)); - fscanf(fp,"%d %s %c %d %d %d %s %s %s",&ans[0]->number,&ans[0]->name,&ans[0]->sex,&(*ans[0]).birthday.year,&(*ans[0]).birthday.month,&(*ans[0]).birthday.day,ans[0]->address,ans[0]->tel,ans[0]->E_mail); + fscanf(fp,"%d %s %c %d %d %d %s %s %s",&ans[0]->number,ans[0]->name,&ans[0]->sex,&(*ans[0]).birthday.year,&(*ans[0]).birthday.month,&(*ans[0]).birthday.day,ans[0]->address,ans[0]->tel,ans[0]->E_mail); for(i=0;inumber,&ans[i]->name,&ans[i]->sex,&(*ans[i]).birthday.year,&(*ans[i]).birthday.month,&(*ans[i]).birthday.day,ans[i]->address,ans[i]->tel,ans[i]->E_mail); + fscanf(fp,"%d %s %c %d %d %d %s %s %s",&ans[i]->number,ans[i]->name,&ans[i]->sex,&(*ans[i]).birthday.year,&(*ans[i]).birthday.month,&(*ans[i]).birthday.day,ans[i]->address,ans[i]->tel,ans[i]->E_mail); ans[i-1]->link=ans[i]; } ans[i]->link=NULL; @@ -154,7 +155,7 @@ int most(n) if(strcmp(checkname,ans[i]->name)==0) { printf("请输入学生新信息 学号 姓名 性别 出生年 月 日 地址 电话 e-mail:"); - scanf("%d %s %c %d %d %d %s %s %s",&ans[i]->number,&ans[i]->name,&ans[i]->sex,&(*ans[i]).birthday.year,&(*ans[i]).birthday.month,&(*ans[i]).birthday.day,ans[i]->address,ans[i]->tel,ans[i]->E_mail); + scanf("%d %s %c %d %d %d %s %s %s",&ans[i]->number,ans[i]->name,&ans[i]->sex,&(*ans[i]).birthday.year,&(*ans[i]).birthday.month,&(*ans[i]).birthday.day,ans[i]->address,ans[i]->tel,ans[i]->E_mail); getchar(); } } @@ -177,7 +178,7 @@ int most(n) fp=fopen(fpname,"w+"); for(i=0;inumber,&ans[i]->name,&ans[i]->sex,&(*ans[i]).birthday.year,&(*ans[i]).birthday.month,&(*ans[i]).birthday.day,ans[i]->address,ans[i]->tel,ans[i]->E_mail); + fprintf(fp,"%d %s %c %d %d %d %s %s %s",ans[i]->number,ans[i]->name,ans[i]->sex,(*ans[i]).birthday.year,(*ans[i]).birthday.month,(*ans[i]).birthday.day,ans[i]->address,ans[i]->tel,ans[i]->E_mail); } fclose(fp); return(n); diff --git a/3.exe b/3.exe new file mode 100644 index 0000000..a398488 Binary files /dev/null and b/3.exe differ