13187261606 6 years ago
parent 0dce44210c
commit 1181f47aee

@ -68,7 +68,7 @@ void menu()
} }
pNow1->next=NULL; pNow1->next=NULL;
fclose(fp); fclose(fp);
struct student *i,*j,pTemp; struct student *i,*j,pTemp2;
if(phead1 == NULL) if(phead1 == NULL)
return; return;
for(i = phead1; i->next!=NULL;i = i->next) for(i = phead1; i->next!=NULL;i = i->next)
@ -78,11 +78,11 @@ void menu()
if(strcmp(j->id , j->next->id)>0) if(strcmp(j->id , j->next->id)>0)
{ {
strcpy(pTemp.id,j->id); strcpy(j->id,j->next->id); strcpy(j->next->id,pTemp.id); strcpy(pTemp2.id,j->id); strcpy(j->id,j->next->id); strcpy(j->next->id,pTemp2.id);
strcpy(pTemp.name,j->name); strcpy(j->name,j->next->name); strcpy(j->next->name,pTemp.name); strcpy(pTemp2.name,j->name); strcpy(j->name,j->next->name); strcpy(j->next->name,pTemp2.name);
strcpy(pTemp.sex,j->sex); strcpy(j->sex,j->next->sex); strcpy(j->next->sex,pTemp.sex); strcpy(pTemp2.sex,j->sex); strcpy(j->sex,j->next->sex); strcpy(j->next->sex,pTemp2.sex);
strcpy(pTemp.note,j->note); strcpy(j->note,j->next->note); strcpy(j->next->note,pTemp.note); strcpy(pTemp2.note,j->note); strcpy(j->note,j->next->note); strcpy(j->next->note,pTemp2.note);
pTemp.age=j->age; j->age=j->next->age; j->next->age=pTemp.age; pTemp2.age=j->age; j->age=j->next->age; j->next->age=pTemp2.age;
} }
} }
} }
@ -190,21 +190,21 @@ void Save(struct student *phead)
} }
void R_Save(struct student *phead) void R_Save(struct student *phead)
{ {
struct student *pTemp; struct student *pTemp1;
pTemp=phead; pTemp1=phead;
FILE *fp; FILE *fp;
if(pTemp!=NULL) if(pTemp1!=NULL)
{ {
if((fp=fopen("D:\\学生信息.txt","w"))!=NULL) if((fp=fopen("D:\\学生信息.txt","w"))!=NULL)
{ {
while(pTemp!=NULL) while(pTemp1!=NULL)
{ {
fprintf(fp,"%s ",pTemp->id); fprintf(fp,"%s ",pTemp1->id);
fprintf(fp,"%s ",pTemp->name); fprintf(fp,"%s ",pTemp1->name);
fprintf(fp,"%s ",pTemp->sex); fprintf(fp,"%s ",pTemp1->sex);
fprintf(fp,"%d ",pTemp->age); fprintf(fp,"%d ",pTemp1->age);
fprintf(fp,"%s ",pTemp->note); fprintf(fp,"%s ",pTemp1->note);
pTemp=pTemp->next; pTemp1=pTemp1->next;
} }
fclose(fp); fclose(fp);
} }
@ -536,6 +536,7 @@ int main()
{ {
setposition(40,14); setposition(40,14);
printf("\t\t\t密码错误!\n"); printf("\t\t\t密码错误!\n");
Sleep(1000);
goto Re; goto Re;
} }

Binary file not shown.
Loading…
Cancel
Save