|
|
@ -33,7 +33,7 @@ void credit(int n)
|
|
|
|
printf("请输入用于存放文件的路径及路径名:");
|
|
|
|
printf("请输入用于存放文件的路径及路径名:");
|
|
|
|
scanf("%s",fpname);
|
|
|
|
scanf("%s",fpname);
|
|
|
|
getchar();
|
|
|
|
getchar();
|
|
|
|
fp=fopen(fpname,"w+");
|
|
|
|
fp=fopen(fpname,"a+");
|
|
|
|
head=(struct student *)malloc(sizeof(struct student));
|
|
|
|
head=(struct student *)malloc(sizeof(struct student));
|
|
|
|
printf("请输入学生学号 姓名 性别 出生年 月 日 地址 电话 e_mail:");
|
|
|
|
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);
|
|
|
@ -67,9 +67,9 @@ int show2(int n)
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int search1(int n)
|
|
|
|
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);
|
|
|
|
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)
|
|
|
|
if(strcmp(checkname,head->name)==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
|
|
|
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);
|
|
|
|
fclose(fp);
|
|
|
|
fclose(fp);
|
|
|
|
return(1);
|
|
|
|
return(1);
|