/*obf.c*/
void Ope(struct _stu *head,char *a,char x) /*打开一已有文件*/
{FILE *fp;
struct _stu *p1,*p=head;
char b='n';
if(!x)
{while(b=='n'||b=='N')
{printf("Please input the filename:");
scanf("%12s",a);while(getchar()!=10);
b=0;
while(a !='.'&&a!='/0') b++;
a='.',a='v',a='/0';
printf("Are you sure to open file %s?",a);
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}if((fp=fopen(a,"rb"))==0)
{printf("File %s hasn't been found!/n",a);
printf("Now system will help you to build a new one!/n/n");
Bui(head,a,1);
}else
{while(fread(p,sizeof(struct _stu),1,fp))
p1=p,p=p->next=(struct _stu *)malloc(sizeof(struct _stu));
p1->next=0;fclose(fp);
printf("OK,the file has been found!/nThe line is as follows:/n/n");
output(head);
}
}
void Bui(struct _stu *head,char *a,char x) /*新建并输入*/
{FILE *fp;
struct _stu *p1,*p2;
char i=0,b='n';
int c,n;
if(!x)
{while(b=='n'||b=='N')
{printf("Please input the filename:");
scanf("%12s",a);while(getchar()!=10);
b=0;
while(a!='.'&&a!='/0') b++;
a='.',a='v',a='/0';
printf("Are you sure to build file %s?",a);
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}if((fp=fopen(a,"rb"))!=0)
{fclose(fp);
printf("The file %s has been standed!Please choose:/n1:open it./n",a);
printf("2:delete it and build a new one./n");
printf("WARNING! if you choose the second adition,you must save it at last!/n");
scanf("%d",&c);while(getchar()!=10);
while(c!=1&&c!=2)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&c);while(getchar()!=10);
}if(c==1) Ope(head,a,1);
}if(c==2||x||!fopen(a,"rb"))
{printf("please input the number of the students:");
scanf("%d",&n);while(getchar()!=10);
while(i<n)
{if(!i) p2=p1=head;
else p2=p2->next=p1=(struct _stu *)malloc(sizeof(struct _stu));
i++;
Input(p1,i);
}p1->next=0;
printf("/nThe score you input is as follow,please check it:/n");
output(head);
printf("/nIs it all right?(y//n):");
scanf(" %c",&b);while(getchar()!=10);
while(b!='Y'&&b!='y'&&b!='N'&&b!='n')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}if(b=='n'||b=='N')
{p1=head;
for(i=1;i<=n;i++)
{Input(p1,i);
p1=p1->next;
}
}
}
}
/*pcgate.c*/
char pcg(void) /*门警系统*/
{struct _mima *head=0,*p=0;
char a[16],b[16],i,c='n',j;
FILE *fp;
printf("This is the gate of the program!/n");
if((fp=fopen("mima","rb"))==0)
{head=p=malloc(sizeof(struct _mima));strcpy(p->no,"zhouyi");
strcpy(p->mima,"2752891");p=p->next=malloc(sizeof(struct _mima));
strcpy(p->no,"100");strcpy(p->mima,"100");
j=2,p=head,fp=fopen("mima","wb");
for(i=0;i<2;i++)
{fwrite(p,sizeof(struct _mima)-2,1,fp);p=p->next;}
fclose(fp);
}else
for(i=0,head=p=malloc(sizeof(struct _mima));fread(p,sizeof(struct _mima)-2,1,fp);i++,
p=p->next=malloc(sizeof(struct _mima)));
j=i;while(c=='n')
{printf("Please input your user name.:");
scanf("%16s",a);
printf("Please input your password:");
scanf("%16s",b);getchar();p=head;
for(i=0;i<j;i++)
{if(!strcmp(a,p->no)&&!strcmp(b,p->mima)) break;p=p->next;}
if(i!=j)
{printf("It is all right!/n");
if(!i) printf("Welcome,my dear host!/n");
else if(i==4) printf("Welcome,my dear hostness!/n");
else printf("Welcome,my dear guest!/n");c='y';
}else
{printf("There are something wrong,you must input again!/n");c='n';}
}
fclose(fp);
printf("Press enter key to continue------");
while(getchar()!=10);
return i;
}
void chg(char a) /*修改密码*/
{char i;
FILE *fp;
struct _mima *p=malloc(sizeof(struct _mima));
fp=fopen("mima","rb+");
for(i=0;i<=a;i++)fread(p,sizeof(struct _mima)-2,1,fp);
fseek(fp,-32L,1);
printf("Please input the new password:");
scanf("%16s",p->mima);
fwrite(p,sizeof(struct _mima)-2,1,fp);
fclose(fp);
printf("OK,the code has been changed!/n");
}
void mag(void)
{char i,j,b='y',a[16];int c;
struct _mima *head,*p,*p0;
FILE *fp=fopen("mima","rb+");
for(i=0,head=p=malloc(sizeof(struct _mima));fread(p,sizeof(struct _mima)-2,1,fp);i++,
p=p->next=malloc(sizeof(struct _mima)));p=head->next;
printf("The usernames are as follows:/n");
for(j=1;j<i;j++,p=p->next) printf("%s/n",p->no);
printf("Now please choose:/n1:Delete someone. 2:Add someome. 3:Exit./n");
scanf("%d",&c);while(c!=1&&c!=2&&c!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&c);while(getchar()!=10);
}if(c==1)
while(b=='y'||b=='Y')
{b='n';while(b=='n'||b=='N')
{printf("Please input the usename:");scanf("%16s",a);while(getchar()!=10);
printf("Are you sure to delete the user %s?",a);scanf(" %c",&b);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}p=head;for(j=0;j<i;j++)
{if(!strcmp(p->no,a)) break;
p0=p,p=p->next;
}if(j==i)printf("The user can't be found,system can't delete it!/n");
else
{fclose(fp);fp=fopen("mima","wb");p0->next=p->next;p=head;i--;
for(c=0;c<i;c++)
{fwrite(p,sizeof(struct _mima)-2,1,fp);p=p->next;}
printf("OK,the user has been deleted!/n");
}printf("Do you want to delete another?");
scanf(" %c",&b);while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}if(c==2)
while(b=='y'||b=='Y')
{b='n',p=malloc(sizeof(struct _mima));while(b=='n'||b=='N')
{printf("Please input the usename:");scanf("%16s",p->no);while(getchar()!=10);
printf("Are you sure to add the user %s?",p->no);scanf(" %c",&b);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}strcpy(p->mima,p->no);fwrite(p,sizeof(struct _mima)-2,1,fp);
printf("OK,it has been added!/nDo you want to add another?");scanf(" %c",&b);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}fclose(fp);
}
/*MAIN.C*/
# include "file.c"
# include "pcgate.c"
# include "obf.c"
# include "edt.c"
# include "find.c"
main()
{struct _stu * head;
FILE *fp;
char mm,b='y',c[15];
int a=0;
head=malloc(sizeof(struct _stu));
mm=pcg();
printf("/n***************************************************/n/n");
printf("Now please choose:/n");
if(!mm) printf("0:manage the user./n");
printf("1:change the code./n");
printf("2:Open a file./n3:Build a new file./n4:Exit./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3&&a!=4&&(mm||!mm&&a))
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a==1||!a)
{if(a==1)chg(mm);if(!a)mag();getchar();
printf("Press enter key to continue------");
while(getchar()!=10);
printf("/nPlease choose:/n1:Open a file./n2:Build a new file./n3:Exit./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}a+=1;
}if(a==2) Ope(head,c,0);
else if(a==3) Bui(head,c,0);
if(a!=4)
{while(b=='y'||b=='Y')
{printf("/n***************************************************/n/n");
printf("Now please choose:/n1:Find someone's record and edit it./n");
printf("2:Delete someone's record./n3:Add a new record./n4:Exit./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3&&a!=4)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a==1) fin(head);
else if(a==2)
{char a,b='y';
while(b=='y'||b=='Y')
{if(!del(head,_find(head,&a))) free(head),head=0;
printf("Now the line is as follows:/n");
output(head);
printf("%d records has been deleted!/n/n",a);
printf("Do you want to delete another record?");
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}else if(a==3) if(head) add(head);else
{char c='y',i=1;
struct _stu *p;
while(c=='Y'|c=='y')
{if(i==1) p=head=(struct _stu *)malloc(sizeof(struct _stu));
else p=p->next=(struct _stu *)malloc(sizeof(struct _stu));
Input(p,i);
printf("Do you want to add another record?(Y//N)");
scanf(" %c",&c);while(getchar()!=10);
while(c!='y'&&c!='Y'&&c!='N'&&c!='n')
{printf("Choosing ERORR!Please choose again:");
scanf("%c",&c);while(getchar()!=10);
}i++;
}p->next=0;
}if(a==4) b='n';else
{printf("/n----------------------------------------------------/n/n");
printf("Do you want to continue to do with this line?(Y//N)");
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='N'&&b!='n')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}printf("Press enter key to continue------");
while(getchar()!=10);
printf("/n***************************************************/n/n");
printf("/nOK,Now the line is as follows:/n/n");
output(head);printf("/nThe file name is:%s/n",c);
printf("/nPlease choose:/n1:Save it as the filename given./n");
printf("2:Save it as another name./n3:Not save it/n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a!=3)
{if(a==2)
{printf("Please input the file name:");
scanf("%12s",c);while(getchar()!=10);
a=0;while(c[a]!='.'&&c[a]!='/0') a++;
c[a]='.',c[a+1]='v',c[a+2]='/0';
}printf("/nPlease choose:/n1:Save it as normal./n");
printf("2:Save it sorted by no./n3:Save it sorted by name./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a==2) sort(head,1);else if(a==3) sort(head,2);
fp=fopen(c,"wb");
while(head!=0)
{fwrite(head,sizeof(struct _stu),1,fp);
head=head->next;
}fclose(fp);
printf("/nThe file has been saved,BYE BYE!/n/n");
}else printf("/nOK,BYE BYE!/n/n");
}
}
void Ope(struct _stu *head,char *a,char x) /*打开一已有文件*/
{FILE *fp;
struct _stu *p1,*p=head;
char b='n';
if(!x)
{while(b=='n'||b=='N')
{printf("Please input the filename:");
scanf("%12s",a);while(getchar()!=10);
b=0;
while(a !='.'&&a!='/0') b++;
a='.',a='v',a='/0';
printf("Are you sure to open file %s?",a);
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}if((fp=fopen(a,"rb"))==0)
{printf("File %s hasn't been found!/n",a);
printf("Now system will help you to build a new one!/n/n");
Bui(head,a,1);
}else
{while(fread(p,sizeof(struct _stu),1,fp))
p1=p,p=p->next=(struct _stu *)malloc(sizeof(struct _stu));
p1->next=0;fclose(fp);
printf("OK,the file has been found!/nThe line is as follows:/n/n");
output(head);
}
}
void Bui(struct _stu *head,char *a,char x) /*新建并输入*/
{FILE *fp;
struct _stu *p1,*p2;
char i=0,b='n';
int c,n;
if(!x)
{while(b=='n'||b=='N')
{printf("Please input the filename:");
scanf("%12s",a);while(getchar()!=10);
b=0;
while(a!='.'&&a!='/0') b++;
a='.',a='v',a='/0';
printf("Are you sure to build file %s?",a);
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}if((fp=fopen(a,"rb"))!=0)
{fclose(fp);
printf("The file %s has been standed!Please choose:/n1:open it./n",a);
printf("2:delete it and build a new one./n");
printf("WARNING! if you choose the second adition,you must save it at last!/n");
scanf("%d",&c);while(getchar()!=10);
while(c!=1&&c!=2)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&c);while(getchar()!=10);
}if(c==1) Ope(head,a,1);
}if(c==2||x||!fopen(a,"rb"))
{printf("please input the number of the students:");
scanf("%d",&n);while(getchar()!=10);
while(i<n)
{if(!i) p2=p1=head;
else p2=p2->next=p1=(struct _stu *)malloc(sizeof(struct _stu));
i++;
Input(p1,i);
}p1->next=0;
printf("/nThe score you input is as follow,please check it:/n");
output(head);
printf("/nIs it all right?(y//n):");
scanf(" %c",&b);while(getchar()!=10);
while(b!='Y'&&b!='y'&&b!='N'&&b!='n')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}if(b=='n'||b=='N')
{p1=head;
for(i=1;i<=n;i++)
{Input(p1,i);
p1=p1->next;
}
}
}
}
/*pcgate.c*/
char pcg(void) /*门警系统*/
{struct _mima *head=0,*p=0;
char a[16],b[16],i,c='n',j;
FILE *fp;
printf("This is the gate of the program!/n");
if((fp=fopen("mima","rb"))==0)
{head=p=malloc(sizeof(struct _mima));strcpy(p->no,"zhouyi");
strcpy(p->mima,"2752891");p=p->next=malloc(sizeof(struct _mima));
strcpy(p->no,"100");strcpy(p->mima,"100");
j=2,p=head,fp=fopen("mima","wb");
for(i=0;i<2;i++)
{fwrite(p,sizeof(struct _mima)-2,1,fp);p=p->next;}
fclose(fp);
}else
for(i=0,head=p=malloc(sizeof(struct _mima));fread(p,sizeof(struct _mima)-2,1,fp);i++,
p=p->next=malloc(sizeof(struct _mima)));
j=i;while(c=='n')
{printf("Please input your user name.:");
scanf("%16s",a);
printf("Please input your password:");
scanf("%16s",b);getchar();p=head;
for(i=0;i<j;i++)
{if(!strcmp(a,p->no)&&!strcmp(b,p->mima)) break;p=p->next;}
if(i!=j)
{printf("It is all right!/n");
if(!i) printf("Welcome,my dear host!/n");
else if(i==4) printf("Welcome,my dear hostness!/n");
else printf("Welcome,my dear guest!/n");c='y';
}else
{printf("There are something wrong,you must input again!/n");c='n';}
}
fclose(fp);
printf("Press enter key to continue------");
while(getchar()!=10);
return i;
}
void chg(char a) /*修改密码*/
{char i;
FILE *fp;
struct _mima *p=malloc(sizeof(struct _mima));
fp=fopen("mima","rb+");
for(i=0;i<=a;i++)fread(p,sizeof(struct _mima)-2,1,fp);
fseek(fp,-32L,1);
printf("Please input the new password:");
scanf("%16s",p->mima);
fwrite(p,sizeof(struct _mima)-2,1,fp);
fclose(fp);
printf("OK,the code has been changed!/n");
}
void mag(void)
{char i,j,b='y',a[16];int c;
struct _mima *head,*p,*p0;
FILE *fp=fopen("mima","rb+");
for(i=0,head=p=malloc(sizeof(struct _mima));fread(p,sizeof(struct _mima)-2,1,fp);i++,
p=p->next=malloc(sizeof(struct _mima)));p=head->next;
printf("The usernames are as follows:/n");
for(j=1;j<i;j++,p=p->next) printf("%s/n",p->no);
printf("Now please choose:/n1:Delete someone. 2:Add someome. 3:Exit./n");
scanf("%d",&c);while(c!=1&&c!=2&&c!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&c);while(getchar()!=10);
}if(c==1)
while(b=='y'||b=='Y')
{b='n';while(b=='n'||b=='N')
{printf("Please input the usename:");scanf("%16s",a);while(getchar()!=10);
printf("Are you sure to delete the user %s?",a);scanf(" %c",&b);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}p=head;for(j=0;j<i;j++)
{if(!strcmp(p->no,a)) break;
p0=p,p=p->next;
}if(j==i)printf("The user can't be found,system can't delete it!/n");
else
{fclose(fp);fp=fopen("mima","wb");p0->next=p->next;p=head;i--;
for(c=0;c<i;c++)
{fwrite(p,sizeof(struct _mima)-2,1,fp);p=p->next;}
printf("OK,the user has been deleted!/n");
}printf("Do you want to delete another?");
scanf(" %c",&b);while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}if(c==2)
while(b=='y'||b=='Y')
{b='n',p=malloc(sizeof(struct _mima));while(b=='n'||b=='N')
{printf("Please input the usename:");scanf("%16s",p->no);while(getchar()!=10);
printf("Are you sure to add the user %s?",p->no);scanf(" %c",&b);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}strcpy(p->mima,p->no);fwrite(p,sizeof(struct _mima)-2,1,fp);
printf("OK,it has been added!/nDo you want to add another?");scanf(" %c",&b);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}fclose(fp);
}
/*MAIN.C*/
# include "file.c"
# include "pcgate.c"
# include "obf.c"
# include "edt.c"
# include "find.c"
main()
{struct _stu * head;
FILE *fp;
char mm,b='y',c[15];
int a=0;
head=malloc(sizeof(struct _stu));
mm=pcg();
printf("/n***************************************************/n/n");
printf("Now please choose:/n");
if(!mm) printf("0:manage the user./n");
printf("1:change the code./n");
printf("2:Open a file./n3:Build a new file./n4:Exit./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3&&a!=4&&(mm||!mm&&a))
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a==1||!a)
{if(a==1)chg(mm);if(!a)mag();getchar();
printf("Press enter key to continue------");
while(getchar()!=10);
printf("/nPlease choose:/n1:Open a file./n2:Build a new file./n3:Exit./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}a+=1;
}if(a==2) Ope(head,c,0);
else if(a==3) Bui(head,c,0);
if(a!=4)
{while(b=='y'||b=='Y')
{printf("/n***************************************************/n/n");
printf("Now please choose:/n1:Find someone's record and edit it./n");
printf("2:Delete someone's record./n3:Add a new record./n4:Exit./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3&&a!=4)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a==1) fin(head);
else if(a==2)
{char a,b='y';
while(b=='y'||b=='Y')
{if(!del(head,_find(head,&a))) free(head),head=0;
printf("Now the line is as follows:/n");
output(head);
printf("%d records has been deleted!/n/n",a);
printf("Do you want to delete another record?");
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='n'&&b!='N')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}else if(a==3) if(head) add(head);else
{char c='y',i=1;
struct _stu *p;
while(c=='Y'|c=='y')
{if(i==1) p=head=(struct _stu *)malloc(sizeof(struct _stu));
else p=p->next=(struct _stu *)malloc(sizeof(struct _stu));
Input(p,i);
printf("Do you want to add another record?(Y//N)");
scanf(" %c",&c);while(getchar()!=10);
while(c!='y'&&c!='Y'&&c!='N'&&c!='n')
{printf("Choosing ERORR!Please choose again:");
scanf("%c",&c);while(getchar()!=10);
}i++;
}p->next=0;
}if(a==4) b='n';else
{printf("/n----------------------------------------------------/n/n");
printf("Do you want to continue to do with this line?(Y//N)");
scanf(" %c",&b);while(getchar()!=10);
while(b!='y'&&b!='Y'&&b!='N'&&b!='n')
{printf("Choosing ERORR!Please choose again:");
scanf(" %c",&b);while(getchar()!=10);
}
}
}printf("Press enter key to continue------");
while(getchar()!=10);
printf("/n***************************************************/n/n");
printf("/nOK,Now the line is as follows:/n/n");
output(head);printf("/nThe file name is:%s/n",c);
printf("/nPlease choose:/n1:Save it as the filename given./n");
printf("2:Save it as another name./n3:Not save it/n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a!=3)
{if(a==2)
{printf("Please input the file name:");
scanf("%12s",c);while(getchar()!=10);
a=0;while(c[a]!='.'&&c[a]!='/0') a++;
c[a]='.',c[a+1]='v',c[a+2]='/0';
}printf("/nPlease choose:/n1:Save it as normal./n");
printf("2:Save it sorted by no./n3:Save it sorted by name./n");
scanf("%d",&a);while(getchar()!=10);
while(a!=1&&a!=2&&a!=3)
{printf("Choosing ERORR!Please choose again:");
scanf("%d",&a);while(getchar()!=10);
}if(a==2) sort(head,1);else if(a==3) sort(head,2);
fp=fopen(c,"wb");
while(head!=0)
{fwrite(head,sizeof(struct _stu),1,fp);
head=head->next;
}fclose(fp);
printf("/nThe file has been saved,BYE BYE!/n/n");
}else printf("/nOK,BYE BYE!/n/n");
}
}