|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<conio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
void look(); /*<2A><><EFBFBD><EFBFBD><EFBFBD>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD>*/
|
|
|
|
|
void save(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>溯<EFBFBD><E6BAAF>*/
|
|
|
|
|
void search_name(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD>*/
|
|
|
|
|
void search_number(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>Ų鿴<C5B2><E9BFB4><EFBFBD><EFBFBD>*/
|
|
|
|
|
void order(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
void del(); /*<2A><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
int openl(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2BFAABA><EFBFBD>*/
|
|
|
|
|
void type(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뺯<EFBFBD><EBBAAF>*/
|
|
|
|
|
void see(); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2BFAAB2>鿴<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
struct student /*<2A><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ľṹ<C4BD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
char num[15]; /*ѧ<><D1A7>*/
|
|
|
|
|
char name[20]; /*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
char sex[4]; /*<2A>Ա<EFBFBD>*/
|
|
|
|
|
char age[3]; /*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
char ad[20]; /*<2A><>ַ*/
|
|
|
|
|
char tel[20]; /*<2A>绰*/
|
|
|
|
|
char E[20]; /*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
char year[20];/*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
char month[12];/*<2A>·<EFBFBD>*/
|
|
|
|
|
char day[30];/*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
}stu[100];
|
|
|
|
|
int n; /*<2A><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>*/
|
|
|
|
|
void main() /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int b,flag=0; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
while(1) /*ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t\t<EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ!\n");
|
|
|
|
|
printf("\n\t\t\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("\t\t\t-------------------------------\n");
|
|
|
|
|
printf("\t\t\t1.¼<><C2BC>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ\n\n"); /*¼<><C2BC>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
printf("\t\t\t2.<2E>鿴¼<E9BFB4><C2BC><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n\n"); /*<2A>鿴¼<E9BFB4><C2BC><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
printf("\t\t\t3.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴ѧ<E9BFB4><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ\n\n"); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴ѧ<E9BFB4><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
printf("\t\t\t4.<2E><>ѧ<EFBFBD>Ų鿴ѧ<E9BFB4><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ\n\n"); /*<2A><>ѧ<EFBFBD>Ų鿴ѧ<E9BFB4><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
printf("\t\t\t5.<2E><>ѧ<EFBFBD>Ŷ<EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>\n\n"); /*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("\t\t\t6.ɾ<><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n\n"); /*ɾ<><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
printf("\t\t\t7.<2E><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n\n"); /*<2A><><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("\t\t\t8.<2E><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>\n\n"); /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
printf("\t\t\t0.<2E>˳<EFBFBD>\n\n"); /*<2A>˳<EFBFBD>*/
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&b);
|
|
|
|
|
switch(b)
|
|
|
|
|
{
|
|
|
|
|
case 1:type();break; /*<2A><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
case 2:look();break; /*<2A><><EFBFBD>ò鿴<C3B2><E9BFB4><EFBFBD><EFBFBD>*/
|
|
|
|
|
case 3:search_name();break; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴ѧ<E9BFB4><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
case 4:search_number();break; /*<2A><><EFBFBD><EFBFBD>ѧ<EFBFBD>Ų鿴ѧ<E9BFB4><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
case 5:order();break; /*<2A><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
case 6:del();break;/*<2A><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
case 7:save();break;/*<2A><><EFBFBD>ñ<EFBFBD><C3B1>溯<EFBFBD><E6BAAF>*/
|
|
|
|
|
case 8:see();break;/*<2A><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
case 0:flag=1;break;/*<2A>˳<EFBFBD>SWITCH<43><48><EFBFBD><EFBFBD>*/
|
|
|
|
|
default :printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
|
|
}
|
|
|
|
|
if(flag)
|
|
|
|
|
break; /*<2A><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>0<EFBFBD><30><EFBFBD>˳<EFBFBD>ѭ<EFBFBD><D1AD>*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void type() /*<2A><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
n=openl(); /*<2A><><EFBFBD><EFBFBD>openl<6E><6C><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t\t----------------\n");
|
|
|
|
|
printf("\t\t\tѧ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",&stu[i].num); /*<2A><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7>*/
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",&stu[i].name); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("\t\t\t<EFBFBD>Ա<EFBFBD>:");
|
|
|
|
|
scanf("%s",&stu[i].sex); /*<2A><><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>*/
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",&stu[i].age); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD>ַ:");
|
|
|
|
|
scanf("%s",&stu[i].ad); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ*/
|
|
|
|
|
printf("\t\t\t<EFBFBD>绰:");
|
|
|
|
|
scanf("%d",&stu[i].tel); /*<2A><><EFBFBD><EFBFBD><EFBFBD>绰*/
|
|
|
|
|
printf("\t\t\tE-mail:");
|
|
|
|
|
scanf("%s",&stu[i].E);/*<2A><><EFBFBD><EFBFBD>E-mail*/
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",&stu[i].year);/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>!!");
|
|
|
|
|
getchar();
|
|
|
|
|
save();
|
|
|
|
|
}
|
|
|
|
|
void save() /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
FILE *fp; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ָ<EFBFBD><D6B8>*/
|
|
|
|
|
int i;
|
|
|
|
|
if((fp=fopen("student.txt","wb"))==NULL) /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
return; /*<2A><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>*/
|
|
|
|
|
}
|
|
|
|
|
for(i=0;!feof(fp);i++)
|
|
|
|
|
if(fwrite(&stu[i],sizeof(struct student),1,fp)!=1)
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
fclose(fp); /*<2A>ر<EFBFBD><D8B1>ļ<EFBFBD>*/
|
|
|
|
|
printf("\n\n\n\n\t\t\tѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
|
|
|
|
|
printf("\n\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>!!");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
void look() /*<2A><><EFBFBD><EFBFBD><EFBFBD>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
n=openl(); /*<2A><><EFBFBD><EFBFBD>openl<6E><6C><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("\tѧ<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ַ\t<EFBFBD>绰\tE-mail\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",stu[i].num,stu[i].name,
|
|
|
|
|
stu[i].sex,stu[i].age,stu[i].ad,stu[i].tel,stu[i].E,stu[i].year,stu[i].month,stu[i].day);
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
void search_name() /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
char name[20]; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
n=openl();
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",name);
|
|
|
|
|
printf("\tѧ<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ַ\t<EFBFBD>绰\tE-mail\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(strcmp(stu[i].name,name)==0) /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>бȽ<D0B1>*/
|
|
|
|
|
{
|
|
|
|
|
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",stu[i].num,stu[i].name,
|
|
|
|
|
stu[i].sex,stu[i].age,stu[i].ad,stu[i].tel,stu[i].E,stu[i].year,stu[i].month,stu[i].day);
|
|
|
|
|
printf("\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
void search_number() /*<2A><><EFBFBD>尴ѧ<E5B0B4>Ų鿴<C5B2><E9BFB4><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
char number[15]; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
n=openl();
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",number);
|
|
|
|
|
printf("\tѧ<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ַ\t<EFBFBD>绰\tE-mail\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(strcmp(stu[i].num,number)==0) /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD>е<EFBFBD>ѧ<EFBFBD>Ž<EFBFBD><C5BD>бȽ<D0B1>*/
|
|
|
|
|
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",stu[i].num,stu[i].name,
|
|
|
|
|
stu[i].sex,stu[i].age,stu[i].ad,stu[i].tel,stu[i].E,stu[i].year,stu[i].month,stu[i].day);
|
|
|
|
|
printf("\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
getch();
|
|
|
|
|
}
|
|
|
|
|
void order() /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i,j;
|
|
|
|
|
char a;
|
|
|
|
|
struct student temp; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
n=openl();
|
|
|
|
|
printf("\tѧ<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ַ\t<EFBFBD>绰\tE-mail\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
{
|
|
|
|
|
for(j=i+1;j<n-1;j++)
|
|
|
|
|
if(stu[i].num>stu[j].num)
|
|
|
|
|
{
|
|
|
|
|
temp=stu[i];
|
|
|
|
|
stu[i]= stu[j];
|
|
|
|
|
stu[j]=temp;
|
|
|
|
|
}
|
|
|
|
|
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",stu[i].num,stu[i].name,
|
|
|
|
|
stu[i].sex,stu[i].age,stu[i].ad,stu[i].tel,stu[i].E,stu[i].year,stu[i].month,stu[i].day);
|
|
|
|
|
}
|
|
|
|
|
getch();
|
|
|
|
|
printf("<EFBFBD>Ƿ棿(y or n)");
|
|
|
|
|
scanf("%c",&a);
|
|
|
|
|
if(a=='y') /*<2A>Ƿ<C7B7><F1B1A3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
save();
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD>˳<EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
void del() /*<2A><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
char a;
|
|
|
|
|
char name[20];
|
|
|
|
|
n=openl();
|
|
|
|
|
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",name);
|
|
|
|
|
printf("\tѧ<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ַ\t<EFBFBD>绰\tE-mail\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(strcmp(stu[i].name,name)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",stu[i].num,stu[i].name,
|
|
|
|
|
stu[i].sex,stu[i].age,stu[i].ad,stu[i].tel,stu[i].E,stu[i].year,stu[i].month,stu[i].day);
|
|
|
|
|
getch();
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>?(y or n)");
|
|
|
|
|
getchar();
|
|
|
|
|
scanf("%c",&a);
|
|
|
|
|
if(a=='y') /*<2A>Ƿ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
{
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
stu[i]=stu[i+1];
|
|
|
|
|
n=n-1;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
printf("<EFBFBD>˳<EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
save();
|
|
|
|
|
}
|
|
|
|
|
int openl() /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
if((fp=fopen("student.txt","rb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
("Cannot open file.\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
for(i=0;!feof(fp);i++)
|
|
|
|
|
fread(&stu[i],sizeof(struct student),1,fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
return(i-1);
|
|
|
|
|
}
|
|
|
|
|
void see() /*<2A><EFBFBD><F2BFAAB2>鿴<EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
n=openl();
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴!\n");
|
|
|
|
|
getch();
|
|
|
|
|
printf("\tѧ<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>Ա<EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>ַ\t<EFBFBD>绰\tE-mail\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",stu[i].num,stu[i].name,
|
|
|
|
|
stu[i].sex,stu[i].age,stu[i].ad,stu[i].tel,stu[i].E,stu[i].year,stu[i].month,stu[i].day);
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\n\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|