|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#include<process.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<windows.h>
|
|
|
|
|
struct student
|
|
|
|
|
{
|
|
|
|
|
char id[12];
|
|
|
|
|
char name[20];
|
|
|
|
|
char sex[3];
|
|
|
|
|
int age;
|
|
|
|
|
char note[100];
|
|
|
|
|
struct student *next;
|
|
|
|
|
};
|
|
|
|
|
void setposition(int x,int y)
|
|
|
|
|
{
|
|
|
|
|
HANDLE win = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
|
|
COORD pos = {x,y};
|
|
|
|
|
SetConsoleCursorPosition(win,pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void menu()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\n\n\n\n");
|
|
|
|
|
printf("\t\t|-------------<2D>༶<EFBFBD><E0BCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ----------------|\n");
|
|
|
|
|
printf("\t\t|\t a.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC> |\n");
|
|
|
|
|
printf("\t\t|\t b.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ʾ |\n");
|
|
|
|
|
printf("\t\t|\t c.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> |\n");
|
|
|
|
|
printf("\t\t|\t d.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣɾ<CFA2><C9BE> |\n");
|
|
|
|
|
printf("\t\t|\t e.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD> |\n");
|
|
|
|
|
printf("\t\t|\t f.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ |\n");
|
|
|
|
|
printf("\t\t|\t g.<2E>˳<EFBFBD>ϵͳ |\n");
|
|
|
|
|
printf("\t\t|---------------------------------------------|\n");
|
|
|
|
|
}
|
|
|
|
|
void Rank()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
void R_Save(struct student *phead);
|
|
|
|
|
fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","r");
|
|
|
|
|
struct student *phead1=NULL;
|
|
|
|
|
struct student *pEnd1,*pNew1,*pNow1;
|
|
|
|
|
pNew1=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew1->id);
|
|
|
|
|
fscanf(fp,"%s",pNew1->name);
|
|
|
|
|
fscanf(fp,"%s",pNew1->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew1->age);
|
|
|
|
|
fscanf(fp,"%s",pNew1->note);
|
|
|
|
|
pNew1->next=NULL;
|
|
|
|
|
pEnd1=pNew1;
|
|
|
|
|
phead1=pNew1;
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
pNew1=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew1->id);
|
|
|
|
|
fscanf(fp,"%s",pNew1->name);
|
|
|
|
|
fscanf(fp,"%s",pNew1->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew1->age);
|
|
|
|
|
fscanf(fp,"%s",pNew1->note);
|
|
|
|
|
pNew1->next=NULL;
|
|
|
|
|
pEnd1->next=pNew1;
|
|
|
|
|
pEnd1=pNew1;
|
|
|
|
|
}
|
|
|
|
|
pNow1 = phead1;
|
|
|
|
|
while(pNow1->next->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
pNow1 = pNow1->next;
|
|
|
|
|
}
|
|
|
|
|
pNow1->next=NULL;
|
|
|
|
|
fclose(fp);
|
|
|
|
|
struct student *i,*j,pTemp;
|
|
|
|
|
if(phead1 == NULL)
|
|
|
|
|
return;
|
|
|
|
|
for(i = phead1; i->next!=NULL;i = i->next)
|
|
|
|
|
{
|
|
|
|
|
for(j = phead1; j->next!=NULL; j = j->next)
|
|
|
|
|
{
|
|
|
|
|
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(pTemp.name,j->name); strcpy(j->name,j->next->name); strcpy(j->next->name,pTemp.name);
|
|
|
|
|
strcpy(pTemp.sex,j->sex); strcpy(j->sex,j->next->sex); strcpy(j->next->sex,pTemp.sex);
|
|
|
|
|
strcpy(pTemp.note,j->note); strcpy(j->note,j->next->note); strcpy(j->next->note,pTemp.note);
|
|
|
|
|
pTemp.age=j->age; j->age=j->next->age; j->next->age=pTemp.age;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
R_Save(phead1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct student* Create()
|
|
|
|
|
{
|
|
|
|
|
/*void Save(struct student *phead);*/
|
|
|
|
|
struct student* phead=NULL;
|
|
|
|
|
struct student *pEnd,*pNew;
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
printf("\t\t\t######<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ######\n");
|
|
|
|
|
printf("\t\t\tѧ<EFBFBD>ţ<EFBFBD>"); scanf("%s",pNew->id);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); scanf("%s",pNew->name);
|
|
|
|
|
printf("\t\t\t<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>"); scanf("%s",pNew->sex);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD>䣻"); scanf("%d",&pNew->age);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>");scanf("%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
phead=pNew;
|
|
|
|
|
char key;
|
|
|
|
|
printf("\t\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>루y/<2F><><EFBFBD>⣩<EFBFBD><E2A3A9>\n");
|
|
|
|
|
key = getch();
|
|
|
|
|
while(key=='y')
|
|
|
|
|
{
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
printf("\t\t\t#####<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ######\n");
|
|
|
|
|
printf("\t\t\tѧ<EFBFBD>ţ<EFBFBD>"); scanf("%s",pNew->id);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); scanf("%s",pNew->name);
|
|
|
|
|
printf("\t\t\t<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>"); scanf("%s",pNew->sex);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD>䣻"); scanf("%d",&pNew->age);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>");scanf("%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd->next=pNew;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
printf("\t\t\t<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>루y/<2F><><EFBFBD>⣩<EFBFBD><E2A3A9>\n");
|
|
|
|
|
key = getch();
|
|
|
|
|
}
|
|
|
|
|
struct student *pTemp;
|
|
|
|
|
pTemp=phead;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
if((fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","a"))!=NULL)
|
|
|
|
|
{
|
|
|
|
|
while(pTemp!=NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"%s ",pTemp->id);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->name);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->sex);
|
|
|
|
|
fprintf(fp,"%d ",pTemp->age);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->note);
|
|
|
|
|
pTemp=pTemp->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Print()
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t******ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*******\n");
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","r+");
|
|
|
|
|
char a[4][100];
|
|
|
|
|
int b;
|
|
|
|
|
fscanf(fp,"%s%s%s%d%s",a[0],a[1],a[2],&b,a[3]);
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%s\n",a[0]);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",a[1]);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>%s\n",a[2]);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>䣻%d\n",b);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>%s\n\n",a[3]);
|
|
|
|
|
fscanf(fp,"%s%s%s%d%s",a[0],a[1],a[2],&b,a[3]);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Save(struct student *phead)
|
|
|
|
|
{
|
|
|
|
|
struct student *pTemp;
|
|
|
|
|
pTemp=phead;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
if(pTemp!=NULL)
|
|
|
|
|
{
|
|
|
|
|
if((fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","w"))!=NULL)
|
|
|
|
|
{
|
|
|
|
|
while(pTemp!=NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"%s ",pTemp->id);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->name);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->sex);
|
|
|
|
|
fprintf(fp,"%d ",pTemp->age);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->note);
|
|
|
|
|
pTemp=pTemp->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
Rank();
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
void R_Save(struct student *phead)
|
|
|
|
|
{
|
|
|
|
|
struct student *pTemp;
|
|
|
|
|
pTemp=phead;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
if(pTemp!=NULL)
|
|
|
|
|
{
|
|
|
|
|
if((fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","w"))!=NULL)
|
|
|
|
|
{
|
|
|
|
|
while(pTemp!=NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"%s ",pTemp->id);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->name);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->sex);
|
|
|
|
|
fprintf(fp,"%d ",pTemp->age);
|
|
|
|
|
fprintf(fp,"%s ",pTemp->note);
|
|
|
|
|
pTemp=pTemp->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
struct student* Delete()
|
|
|
|
|
{
|
|
|
|
|
char s[20];
|
|
|
|
|
struct student *pTemp,*pre;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","r");
|
|
|
|
|
struct student *phead=NULL;
|
|
|
|
|
struct student *pEnd,*pNew,*pNow;
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew->id);
|
|
|
|
|
fscanf(fp,"%s",pNew->name);
|
|
|
|
|
fscanf(fp,"%s",pNew->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew->age);
|
|
|
|
|
fscanf(fp,"%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
phead=pNew;
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew->id);
|
|
|
|
|
fscanf(fp,"%s",pNew->name);
|
|
|
|
|
fscanf(fp,"%s",pNew->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew->age);
|
|
|
|
|
fscanf(fp,"%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd->next=pNew;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
}
|
|
|
|
|
pNow = phead;
|
|
|
|
|
while(pNow->next->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
pNow = pNow->next;
|
|
|
|
|
}
|
|
|
|
|
pNow->next=NULL;
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
renew: pre=pTemp=phead; int i=1;
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
while(strcmp(pTemp->id,s))
|
|
|
|
|
{
|
|
|
|
|
i++;
|
|
|
|
|
pTemp=pTemp->next;
|
|
|
|
|
if(pTemp==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\tѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
goto renew;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(i>1)
|
|
|
|
|
{
|
|
|
|
|
pre=pTemp=phead;
|
|
|
|
|
int j;
|
|
|
|
|
for(j=1;j<i;j++)
|
|
|
|
|
{
|
|
|
|
|
pre=pTemp;
|
|
|
|
|
pTemp=pTemp->next;
|
|
|
|
|
}
|
|
|
|
|
pre->next=pTemp->next;
|
|
|
|
|
free(pTemp);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pTemp=phead;
|
|
|
|
|
phead=phead->next;
|
|
|
|
|
free(pTemp);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
system("pause");
|
|
|
|
|
return phead;
|
|
|
|
|
}
|
|
|
|
|
void search()
|
|
|
|
|
{
|
|
|
|
|
struct student *pTemp;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","r");
|
|
|
|
|
struct student *phead=NULL;
|
|
|
|
|
struct student *pEnd,*pNew,*pNow;
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew->id);
|
|
|
|
|
fscanf(fp,"%s",pNew->name);
|
|
|
|
|
fscanf(fp,"%s",pNew->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew->age);
|
|
|
|
|
fscanf(fp,"%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
phead=pNew;
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew->id);
|
|
|
|
|
fscanf(fp,"%s",pNew->name);
|
|
|
|
|
fscanf(fp,"%s",pNew->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew->age);
|
|
|
|
|
fscanf(fp,"%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd->next=pNew;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
}
|
|
|
|
|
pNow = phead;
|
|
|
|
|
while(pNow->next->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
pNow = pNow->next;
|
|
|
|
|
}
|
|
|
|
|
pNow->next=NULL;
|
|
|
|
|
fclose(fp);
|
|
|
|
|
char x; char s[20];
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ʽ\n1.ѧ<>Ų<EFBFBD>ѯ\n2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ\n3.<2E>Ա<EFBFBD><D4B1><EFBFBD>ѯ\n4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ\n");
|
|
|
|
|
RE: x=getch();
|
|
|
|
|
fflush(stdin); //<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
RE1: pTemp=phead; int Y=0; int flag = 1;
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case'1':
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
break;
|
|
|
|
|
case'2':
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
break;
|
|
|
|
|
case'3':
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
break;
|
|
|
|
|
case'4':
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺");
|
|
|
|
|
scanf("%d",&Y);
|
|
|
|
|
goto jump;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
goto RE;
|
|
|
|
|
}
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
jump: while(pTemp!=NULL)
|
|
|
|
|
{
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case'1':
|
|
|
|
|
if(strcmp(s,pTemp->id)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%s\n",pTemp->id);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->name);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->sex);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>䣻%d\n",pTemp->age);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>%s\n",pTemp->note);
|
|
|
|
|
flag = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case'2':
|
|
|
|
|
if(strcmp(s,pTemp->name)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%s\n",pTemp->id);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->name);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->sex);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>䣻%d\n",pTemp->age);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>%s\n",pTemp->note);
|
|
|
|
|
flag = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case'3':
|
|
|
|
|
if(strcmp(s,pTemp->sex)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%s\n",pTemp->id);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->name);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->sex);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>䣻%d\n",pTemp->age);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>%s\n",pTemp->note);
|
|
|
|
|
flag = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case'4':
|
|
|
|
|
if(Y==pTemp->age)
|
|
|
|
|
{
|
|
|
|
|
printf("ѧ<EFBFBD>ţ<EFBFBD>%s\n",pTemp->id);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->name);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>%s\n",pTemp->sex);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>䣻%d\n",pTemp->age);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>%s\n",pTemp->note);
|
|
|
|
|
flag = 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
pTemp=pTemp->next;
|
|
|
|
|
}
|
|
|
|
|
if(flag)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\tδ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>\n");
|
|
|
|
|
goto RE1;
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
struct student* Change()
|
|
|
|
|
{
|
|
|
|
|
struct student *pTemp;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen("D:\\ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","r");
|
|
|
|
|
struct student *phead=NULL;
|
|
|
|
|
struct student *pEnd,*pNew,*pNow;
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew->id);
|
|
|
|
|
fscanf(fp,"%s",pNew->name);
|
|
|
|
|
fscanf(fp,"%s",pNew->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew->age);
|
|
|
|
|
fscanf(fp,"%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
phead=pNew;
|
|
|
|
|
while(!feof(fp))
|
|
|
|
|
{
|
|
|
|
|
pNew=(struct student*)malloc(sizeof(struct student));
|
|
|
|
|
fscanf(fp,"%s",pNew->id);
|
|
|
|
|
fscanf(fp,"%s",pNew->name);
|
|
|
|
|
fscanf(fp,"%s",pNew->sex);
|
|
|
|
|
fscanf(fp,"%d",&pNew->age);
|
|
|
|
|
fscanf(fp,"%s",pNew->note);
|
|
|
|
|
pNew->next=NULL;
|
|
|
|
|
pEnd->next=pNew;
|
|
|
|
|
pEnd=pNew;
|
|
|
|
|
}
|
|
|
|
|
pNow = phead;
|
|
|
|
|
while(pNow->next->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
pNow = pNow->next;
|
|
|
|
|
}
|
|
|
|
|
pNow->next=NULL;
|
|
|
|
|
char s[20];
|
|
|
|
|
char m[10]; int flag=1;
|
|
|
|
|
RE1: printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺 ");
|
|
|
|
|
scanf("%s",m);
|
|
|
|
|
if(strcmp(m,"123456")==0)
|
|
|
|
|
{
|
|
|
|
|
RE: pTemp=phead;
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
while(pTemp!=NULL)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(s,pTemp->id)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\tѧ<EFBFBD>ţ<EFBFBD>%s\t\t\t<EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>",pTemp->id); scanf("%s",pTemp->id);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",pTemp->name); scanf("%s",pTemp->name);
|
|
|
|
|
printf("\t\t\t<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>%s\t\t\t<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>",pTemp->sex); scanf("%s",pTemp->sex);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD>䣻%d\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺",pTemp->age); scanf("%d",&pTemp->age);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>%s\t\t\t<EFBFBD>ı<EFBFBD>ע<EFBFBD><EFBFBD>",pTemp->note); scanf("%s",pTemp->note);
|
|
|
|
|
flag = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
pTemp=pTemp->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
goto RE1;
|
|
|
|
|
}
|
|
|
|
|
if(flag)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\tѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
goto RE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
return phead;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
/*system("mode con cols=80 lines=30");*/
|
|
|
|
|
system("color F5");
|
|
|
|
|
char x=0;
|
|
|
|
|
char m[7];
|
|
|
|
|
struct student *head=NULL;
|
|
|
|
|
Re:
|
|
|
|
|
setposition(40,14);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺 ");
|
|
|
|
|
setposition(39,13);
|
|
|
|
|
printf("*********************");
|
|
|
|
|
setposition(39,15);
|
|
|
|
|
printf("*********************");
|
|
|
|
|
setposition(39,14);
|
|
|
|
|
printf("*");
|
|
|
|
|
setposition(59,14);
|
|
|
|
|
printf("*");
|
|
|
|
|
setposition(51,14);
|
|
|
|
|
scanf("%s",m);
|
|
|
|
|
if(strcmp(m,"aaaaaa")==0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(x=='g')
|
|
|
|
|
exit(0);
|
|
|
|
|
switch(x)
|
|
|
|
|
{
|
|
|
|
|
case'a':
|
|
|
|
|
Create();
|
|
|
|
|
break;
|
|
|
|
|
case'b':
|
|
|
|
|
Print();
|
|
|
|
|
break;
|
|
|
|
|
case'c':
|
|
|
|
|
Save(head);
|
|
|
|
|
break;
|
|
|
|
|
case'd':
|
|
|
|
|
head=Delete();
|
|
|
|
|
break;
|
|
|
|
|
case'e':
|
|
|
|
|
head=Change();
|
|
|
|
|
break;
|
|
|
|
|
case'f':
|
|
|
|
|
search();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
menu();
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫִ<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%c",&x);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
setposition(40,14);
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n"); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
goto Re;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|