|
|
|
|
#include"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.c"
|
|
|
|
|
void refresh()/*<2A><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i=0;/*<2A><><EFBFBD>㵼<EFBFBD><E3B5BC>ѧ<EFBFBD><D1A7><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>*/
|
|
|
|
|
if((fp=fopen("student.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("δ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> <20><><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
exit(0);/*<2A><>δ<EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
}
|
|
|
|
|
while(fscanf(fp,"%s %s %d %s %s %s %s %s",stu[i].id,stu[i].name,&stu[i].age,stu[i].sex,stu[i].birth,stu[i].add,stu[i].tel,stu[i].email)!=EOF)
|
|
|
|
|
i++;
|
|
|
|
|
n=i;
|
|
|
|
|
if(fclose(fp))/*<2A><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ر<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
printf("cannot close the file");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("ˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
void seek()/*<2A><><EFBFBD>Һ<EFBFBD><D2BA><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i,num,flag;
|
|
|
|
|
char ch[LEN+1];/*<2A><><EFBFBD>ڴ<EFBFBD><DAB4>Ų<EFBFBD>ѯѧ<D1AF><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("**************\n");
|
|
|
|
|
printf("1:<3A><>ѧ<EFBFBD>Ų<EFBFBD>ѯ\n");
|
|
|
|
|
printf("2:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ\n");
|
|
|
|
|
printf("3:<3A>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>β<EFBFBD>ѯ\n");
|
|
|
|
|
printf("**************\n");
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&num);
|
|
|
|
|
flag=0;
|
|
|
|
|
switch(num)
|
|
|
|
|
{
|
|
|
|
|
case 1: printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",ch);
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(strcmp(stu[i].id,ch)==0)
|
|
|
|
|
{
|
|
|
|
|
flag=1;
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD> ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ա<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ַ <20>绰 E-mail\n");
|
|
|
|
|
printf("-------------------------------------------------------------------------------\n");
|
|
|
|
|
printf("%6s %6s %5d %5s %9s %8s %10s %14s\n",stu[i].id,stu[i].name,stu[i].age,stu[i].sex,stu[i].birth,stu[i].add,stu[i].tel,stu[i].email);
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
printf("ѧ<EFBFBD>Ų<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 2: printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",ch);
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(strcmp(stu[i].name,ch)==0)
|
|
|
|
|
{
|
|
|
|
|
flag=1;
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD> ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ա<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ַ <20>绰 E-mail\n");
|
|
|
|
|
printf("-------------------------------------------------------------------------------\n");
|
|
|
|
|
printf("%6s %6s %5d %5s %9s %8s %10s %14s\n",stu[i].id,stu[i].name,stu[i].age,stu[i].sex,stu[i].birth,stu[i].add,stu[i].tel,stu[i].email);
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");break;
|
|
|
|
|
case 3: return;
|
|
|
|
|
default:printf("ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<><33>ѡ<EFBFBD><D1A1>\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|