You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

793 lines
18 KiB

6 years ago
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NMAX 4 //ѧԺÿ<D4BA><C3BF><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>4<EFBFBD><34>
#define MAX 3 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define PEOPLE_MAX 6 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><36>ֽ<EFBFBD><D6BD><EFBFBD>
struct baoming
{
char number[12];
char school[15];
char name[12];
char sex[10];
char sport1[10];
char sport2[10];
char sport3[10];
};
void sign(struct baoming com,FILE *fp1,char d[])
{
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:\n");
scanf("%s",com.number);
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",com.name);
char a[]={"<EFBFBD><EFBFBD>"};
char b[]={"Ů"};
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>\n");
printf("\t1.<2E><> 2.Ů");
int sex1;
scanf("%d",&sex1);
if(sex1==1)
{
strcpy(com.sex,a);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>У<EFBFBD>");
printf("1.<2E><>ǹ 2.<2E><><EFBFBD><EFBFBD> 3.100<EFBFBD><EFBFBD> 4.400<EFBFBD><EFBFBD> 5.1000<EFBFBD><EFBFBD> 6.5000<EFBFBD><EFBFBD> 7.<2E><>Զ");
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",com.sport1);
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",com.sport2);
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",com.sport3);
fprintf(fp1,"%s %s %s %s %s %s %s\n ",com.number,d,com.name,com.sex,com.sport1,com.sport2,com.sport3);
}
else
{
strcpy(com.sex,b);
printf("Ů<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>У<EFBFBD>");
printf("1.<2E><>ǹ 2.<2E><><EFBFBD><EFBFBD> 3.100<EFBFBD><EFBFBD> 4.400<EFBFBD><EFBFBD> 5.1000<EFBFBD><EFBFBD> 6.5000<EFBFBD><EFBFBD> 7.<2E><>Զ");
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",com.sport1);
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",com.sport2);
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",com.sport3);
fprintf(fp1,"%s %s %s %s %s %s %s\n",com.number,d,com.name,com.sex,com.sport1,com.sport2,com.sport3);
}
fclose(fp1);
printf("<EFBFBD>ټ<EFBFBD>");
}
void sign_up()
{
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ѧԺ:");
printf("1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ 2.<2E><><EFBFBD><EFBFBD>ѧԺ");
printf("3.<2E><><EFBFBD><EFBFBD>ѧԺ 4.<2E><>еѧԺ");
printf("5.<2E><>ľѧԺ 6.<2E><>óѧԺ");
int choice;
scanf("%d",&choice);
switch(choice)
{
case 1:
{
FILE *fp;
char a[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ";
struct baoming stu;
fp=fopen("computer.txt","a+");
if(fp==NULL)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
sign(stu,fp,a);
break;
}
case 2:
{
FILE *fp;
char b[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ";
struct baoming stu;
fp=fopen("dianqi.txt","a+");
if(fp==NULL)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
sign(stu,fp,b);
break;
}
case 3:
{
FILE *fp;
char c[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ";
struct baoming stu;
fp=fopen("wenxin.txt","a+");
if(fp==NULL)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
sign(stu,fp,c);
break;
}
case 4:
{
FILE *fp;
char d[]="<EFBFBD><EFBFBD>еѧԺ";
struct baoming stu;
fp=fopen("jixie.txt","a+");
if(fp==NULL)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
sign(stu,fp,d);
break;
}
case 5:
{
FILE *fp;
char e[]="<EFBFBD><EFBFBD>ľѧԺ";
struct baoming stu;
fp=fopen("tumu.txt","a+");
if(fp==NULL)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
sign(stu,fp,e);
break;
}
case 6:
{
FILE *fp;
char f[]="<EFBFBD><EFBFBD>óѧԺ";
struct baoming stu;
fp=fopen("jingmao.txt","a+");
if(fp==NULL)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
sign(stu,fp,f);
break;
}
}
}
void chaxun(struct baoming stu,FILE *fp1)
{
char numbers[12];
int flag=0;
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>");
scanf("%s",numbers);
while(!feof(fp1)&&flag==0)
{
fscanf(fp1,"%s%s%s%s%s%s%s%s",&stu.number,stu.school,stu.name,stu.sex,stu.sport1,stu.sport2,stu.sport3);
if(strncmp(numbers,stu.number,11)==0)
{
printf("%s %s %s %s %s %s %s",stu.number,stu.name,stu.sex,stu.sport1,stu.sport2,stu.sport3);
flag=1;
printf("\t<EFBFBD><EFBFBD>ѯ<EFBFBD>ɹ<EFBFBD>");
}
}
fclose(fp1);
}
void bmchaxun()
{
int x;
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ");
printf("1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ 2.<2E><><EFBFBD><EFBFBD>ѧԺ");
printf("3.<2E><><EFBFBD><EFBFBD>ѧԺ 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ");
printf("5.<2E><>ľѧԺ 6.<2E><>óѧԺ");
scanf("%d",&x);
switch(x)
{
case 1:
{
struct baoming com;
FILE *fp=fopen("computer.txt","r");
if(fp==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
}
chaxun(com,fp);
break;
}
case 2:
{
struct baoming com;
FILE *fp=fopen("dianqi.txt","r");
if(fp==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
}
chaxun(com,fp);
break;
}
case 3:
{
struct baoming com;
FILE *fp=fopen("wenxin.txt","r");
if(fp==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
}
chaxun(com,fp);
break;
}
case 4:
{
struct baoming com;
FILE *fp=fopen("jixie.txt","r");
if(fp==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
}
chaxun(com,fp);
break;
}
case 5:
{
struct baoming com;
FILE *fp=fopen("tumu.txt","r");
if(fp==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
}
chaxun(com,fp);
break;
}
case 6:
{
struct baoming com;
FILE *fp=fopen("jingmao.txt","r");
if(fp==NULL)
{
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>");
}
chaxun(com,fp);
break;
}
}
}
struct jianlu
{
char number[12];
char school[15];
char name[10];
char sex[5];
char sport[10];
};
void xie_ru(struct baoming stu,FILE *fp,FILE *fp1,char a[])
{
long last,h;
fseek(fp1,0L,SEEK_END);
last=ftell(fp1);
rewind(fp1);
while((h=ftell(fp1))<last-20)
{
fscanf(fp1,"%s%s%s%s%s%s%s",stu.number,stu.school,stu.name,stu.sex,stu.sport1,stu.sport2,stu.sport3);
if((strcmp(a,stu.sport1)==0)||(strcmp(a,stu.sport2)==0)||(strcmp(a,stu.sport3)==0))
{
fprintf(fp,"%s %s %s %s %s\n",stu.school,stu.number,stu.name,stu.sex,a);
}
}
fclose(fp1);
}
void jianlu(struct jianlu stu,FILE *fp)
{
fseek(fp,0L,SEEK_END);
long k;
long last=ftell(fp);
rewind(fp);
while((k=ftell(fp))<last-20)
{
fscanf(fp,"%s%s%s%s%s",stu.school,stu.number,stu.name,stu.sex,stu.sport);
printf("%s %s %s %s %s\n",stu.school,stu.number,stu.name,stu.sex,stu.sport);
}
}
void jianlu() //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
int x;
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ");
printf("1.<2E><>ǹ 2.<2E><><EFBFBD><EFBFBD> 3.100<EFBFBD><EFBFBD> 4.400<EFBFBD><EFBFBD> 5.1000<EFBFBD><EFBFBD> 6.5000<EFBFBD><EFBFBD> 7.<2E><>Զ");
scanf("%d",&x);
FILE *fp1,*fp2,*fp3,*fp4,*fp5,*fp6;
struct baoming stu;
char a[]="<EFBFBD><EFBFBD>ǹ";
FILE *fp=fopen("<EFBFBD><EFBFBD>ǹ.txt","w+");
fp1=fopen("computer.txt","r");
xie_ru(stu,fp,fp1,a);
fp2=fopen("dianqi.txt","r");
xie_ru(stu,fp,fp2,a);
fp3=fopen("wenxin.txt","r");
xie_ru(stu,fp,fp3,a);
fp4=fopen("jixie.txt","r");
xie_ru(stu,fp,fp4,a);
fp5=fopen("tumu.txt","r");
xie_ru(stu,fp,fp5,a);
fp6=fopen("jingmao.txt","r");
xie_ru(stu,fp,fp6,a);
fclose(fp);
char b[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
fp=fopen("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
fp1=fopen("computer.txt","r");
xie_ru(stu,fp,fp1,b);
fp2=fopen("dianqi.txt","r");
xie_ru(stu,fp,fp2,b);
fp3=fopen("wenxin.txt","r");
xie_ru(stu,fp,fp3,b);
fp4=fopen("jixie.txt","r");
xie_ru(stu,fp,fp4,b);
fp5=fopen("tumu.txt","r");
xie_ru(stu,fp,fp5,b);
fp6=fopen("jingmao.txt","r");
xie_ru(stu,fp,fp6,b);
fclose(fp);
char c[]="100<EFBFBD><EFBFBD>";
fp=fopen("100<EFBFBD><EFBFBD>.txt","w+");
fp1=fopen("computer.txt","r");
xie_ru(stu,fp,fp1,c);
fp2=fopen("dianqi.txt","r");
xie_ru(stu,fp,fp2,c);
fp3=fopen("wenxin.txt","r");
xie_ru(stu,fp,fp3,c);
fp4=fopen("jixie.txt","r");
xie_ru(stu,fp,fp4,c);
fp5=fopen("tumu.txt","r");
xie_ru(stu,fp,fp5,c);
fp6=fopen("jingmao.txt","r");
xie_ru(stu,fp,fp6,c);
fclose(fp);
char d[]="400<EFBFBD><EFBFBD>";
fp=fopen("400<EFBFBD><EFBFBD>.txt","w+");
fp1=fopen("computer.txt","r");
xie_ru(stu,fp,fp1,d);
fp2=fopen("dianqi.txt","r");
xie_ru(stu,fp,fp2,d);
fp3=fopen("wenxin.txt","r");
xie_ru(stu,fp,fp3,d);
fp4=fopen("jixie.txt","r");
xie_ru(stu,fp,fp4,d);
fp5=fopen("tumu.txt","r");
xie_ru(stu,fp,fp5,d);
fp6=fopen("jingmao.txt","r");
xie_ru(stu,fp,fp6,d);
fclose(fp);
char e[]="1000<EFBFBD><EFBFBD>";
fp=fopen("1000<EFBFBD><EFBFBD>.txt","w+");
fp1=fopen("computer.txt","r");
xie_ru(stu,fp,fp1,e);
fp2=fopen("dianqi.txt","r");
xie_ru(stu,fp,fp2,e);
fp3=fopen("wenxin.txt","r");
xie_ru(stu,fp,fp3,e);
fp4=fopen("jixie.txt","r");
xie_ru(stu,fp,fp4,e);
fp5=fopen("tumu.txt","r");
xie_ru(stu,fp,fp5,e);
fp6=fopen("jingmao.txt","r");
xie_ru(stu,fp,fp6,e);
fclose(fp);
char f[]="5000<EFBFBD><EFBFBD>";
fp=fopen("5000<EFBFBD><EFBFBD>.txt","w+");
fp1=fopen("computer.txt","r");
xie_ru(stu,fp,fp1,f);
fp2=fopen("dianqi.txt","r");
xie_ru(stu,fp,fp2,f);
fp3=fopen("wenxin.txt","r");
xie_ru(stu,fp,fp3,f);
fp4=fopen("jixie.txt","r");
xie_ru(stu,fp,fp4,f);
fp5=fopen("tumu.txt","r");
xie_ru(stu,fp,fp5,f);
fp6=fopen("jingmao.txt","r");
xie_ru(stu,fp,fp6,f);
fclose(fp);
char g[]="<EFBFBD><EFBFBD>Զ";
fp=fopen("<EFBFBD><EFBFBD>Զ.txt","w+");
fp1=fopen("computer.txt","r");
xie_ru(stu,fp,fp1,g);
fp2=fopen("dianqi.txt","r");
xie_ru(stu,fp,fp2,g);
fp3=fopen("wenxin.txt","r");
xie_ru(stu,fp,fp3,g);
fp4=fopen("jixie.txt","r");
xie_ru(stu,fp,fp4,g);
fp5=fopen("tumu.txt","r");
xie_ru(stu,fp,fp5,g);
fp6=fopen("jingmao.txt","r");
xie_ru(stu,fp,fp6,g);
fclose(fp);
switch(x)
{
case 1:
{
fp=fopen("<EFBFBD><EFBFBD>ǹ.txt","r");
struct jianlu stu;
jianlu(stu,fp);
break;
}
case 2:
{
fp=fopen("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct jianlu stu;
jianlu(stu,fp);
break;
}
case 3:
{
fp=fopen("100<EFBFBD><EFBFBD>.txt","r");
struct jianlu stu;
jianlu(stu,fp);
break;
}
case 4:
{
fp=fopen("400<EFBFBD><EFBFBD>.txt","r");
struct jianlu stu;
jianlu(stu,fp);
break;
}
case 5:
{
fp=fopen("1000<EFBFBD><EFBFBD>.txt","r");
struct jianlu stu;
jianlu(stu,fp);
break;
}
case 6:
{
fp=fopen("5000<EFBFBD><EFBFBD>.txt","r");
struct jianlu stu;
jianlu(stu,fp);
break;
}
case 7:
{
fp=fopen("<EFBFBD><EFBFBD>Զ.txt","r");
struct jianlu stu;
jianlu(stu,fp);
break;
}
}
}
struct dengji
{
char number[13];
char school[15];
char name[8];
char sex[6];
char sport[8];
int defen;
};
int dj(FILE *fp,FILE *fp1,struct dengji stu)
{
long h,last;
int k=0;
fseek(fp,0L,SEEK_END);
last=ftell(fp);
rewind(fp);
while(h=ftell(fp)<last-20)
{
fscanf(fp,"%s%s%s%s%s",stu.school,stu.number,stu.name,stu.sex,stu.sport);
k++;
}
rewind(fp);
if(k<=PEOPLE_MAX)
{
while(h=ftell(fp)<last-20)
{
fscanf(fp,"%s%s%s%s%s",stu.school,stu.number,stu.name,stu.sex,stu.sport);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s<><73>%s<><73><EFBFBD><EFBFBD>",stu.name,stu.sport);
scanf("%d",&stu.defen);
switch(stu.defen)
{
case 1:
fprintf(fp1,"%s %s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,5);
break;
case 2:
fprintf(fp1,"%s %s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,3);
break;
case 3:
fprintf(fp1,"%s %s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,2);
break;
}
}
}
if(k>PEOPLE_MAX)
{
while(h=ftell(fp)<last-20)
{
fscanf(fp,"%s%s%s%s%s",stu.school,stu.number,stu.name,stu.sex,stu.sport);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s<><73>%s<><73><EFBFBD><EFBFBD>",stu.name,stu.sport);
scanf("%d",&stu.defen);
switch(stu.defen)
{
case 1:
fprintf(fp1,"%s %s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,7);
break;
case 2:
fprintf(fp1,"%s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,5);
break;
case 3:
fprintf(fp1,"%s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,3);
break;
case 4:
fprintf(fp1,"%s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,2);
break;
case 5:
fprintf(fp1,"%s %s %s %s %d\n",stu.school,stu.number,stu.name,stu.sex,stu.sport,1);
break;
}
}
}
}
void dengji()
{
int x;
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>\n");
printf("1.<2E><>ǹ 2.<2E><><EFBFBD><EFBFBD> 3.100<EFBFBD><EFBFBD> 4.400<EFBFBD><EFBFBD> 5.1000<EFBFBD><EFBFBD> 6.5000<EFBFBD><EFBFBD> 7.<2E><>Զ");
scanf("%d",&x);
switch(x)
{
case 1:
{
struct dengji stu;
FILE *fp=fopen("<EFBFBD><EFBFBD>ǹ.txt","r");
FILE *fp1=fopen("<EFBFBD><EFBFBD>ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
dj(fp,fp1,stu);
break;
}
case 2:
{
struct dengji stu;
FILE *fp=fopen("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
FILE *fp1=fopen("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
dj(fp,fp1,stu);
break;
}
case 3:
{
struct dengji stu;
FILE *fp=fopen("100<EFBFBD><EFBFBD>.txt","r");
FILE *fp1=fopen("100<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
dj(fp,fp1,stu);
break;
}
case 4:
{
struct dengji stu;
FILE *fp=fopen("400<EFBFBD><EFBFBD>.txt","r");
FILE *fp1=fopen("400<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
dj(fp,fp1,stu);
break;
}
case 5:
{
struct dengji stu;
FILE *fp=fopen("1000<EFBFBD><EFBFBD>.txt","r");
FILE *fp1=fopen("1000<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
dj(fp,fp1,stu);
break;
}
case 6:
{
struct dengji stu;
FILE *fp=fopen("5000<EFBFBD><EFBFBD>.txt","r");
FILE *fp1=fopen("5000<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
dj(fp,fp1,stu);
break;
}
case 7:
{
struct dengji stu;
FILE *fp=fopen("<EFBFBD><EFBFBD>Զ.txt","r");
FILE *fp1=fopen("<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
dj(fp,fp1,stu);
break;
}
}
}
void shuchu(FILE *fp,struct dengji stu)
{
fseek(fp,0L,SEEK_END);
long k;
long last=ftell(fp);
rewind(fp);
while((k=ftell(fp))<last-20)
{
fscanf(fp,"%s%s%s%s%s%d",stu.number,stu.school,stu.name,stu.sex,stu.sport,&stu.defen);
printf("%s %s %s %s %s %d\n",stu.number,stu.school,stu.name,stu.sex,stu.sport,stu.defen);
}
fclose(fp);
}
void cjcx()
{
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ʽ");
printf("1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ 2.<2E><><EFBFBD><EFBFBD>ѧУ(<28><>δʵ<CEB4><CAB5>) 3.<2E><><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>δʵ<CEB4>֣<EFBFBD>");
int x;
scanf("%d",&x);
switch(x)
{
case 1:
{
int d;
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>\n");
printf("1.<2E><>ǹ 2.<2E><><EFBFBD><EFBFBD> 3.100<EFBFBD><EFBFBD> 4.400<EFBFBD><EFBFBD> 5.1000<EFBFBD><EFBFBD> 6.5000<EFBFBD><EFBFBD> 7.<2E><>Զ");
scanf("%d",&d);
switch(d)
{
case 1:
{
FILE *fp=fopen("<EFBFBD><EFBFBD>ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct dengji stu;
shuchu(fp,stu);
break;
}
case 2:
{
FILE *fp=fopen("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct dengji stu;
shuchu(fp,stu);
break;
}
case 3:
{
FILE *fp=fopen("100<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct dengji stu;
shuchu(fp,stu);
break;
}
case 4:
{
FILE *fp=fopen("400<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct dengji stu;
shuchu(fp,stu);
break;
}
case 5:
{
FILE *fp=fopen("1000<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct dengji stu;
shuchu(fp,stu);
break;
}
case 6:
{
FILE *fp=fopen("5000<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct dengji stu;
shuchu(fp,stu);
break;
}
case 7:
{
FILE *fp=fopen("<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
struct dengji stu;
shuchu(fp,stu);
break;
}
}
break;
}
case 2:
{
break;
}
}
}
struct pai
{
char school[15];
int zf;
};
int hehe(FILE *fp,struct dengji stu,char a[])
{
long h,last;
int k=0;
fseek(fp,0L,SEEK_END);
last=ftell(fp);
rewind(fp);
while(h=ftell(fp)<last-20)
{
fscanf(fp,"%s%s%s%s%s%d",stu.school,stu.number,stu.name,stu.sex,stu.sport,&stu.defen);
if(strcmp(stu.school,a)==0)
{
k+=stu.defen;
}
}
return k;
}
int zongfen(char a[])
{
struct dengji stu;
int k=0;
FILE *fp1,*fp2,*fp3,*fp4,*fp5,*fp6,*fp7;
fp1=fopen("<EFBFBD><EFBFBD>ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
k+=hehe(fp1,stu,a);
fp2=fopen("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
k+=hehe(fp2,stu,a);
fp3=fopen("100<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
k+=hehe(fp3,stu,a);
fp4=fopen("400<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
k+=hehe(fp4,stu,a);
fp5=fopen("1000<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
k+=hehe(fp5,stu,a);
fp6=fopen("5000<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
k+=hehe(fp6,stu,a);
fp7=fopen("<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","r");
k+=hehe(fp7,stu,a);
return k;
}
void paixu()
{
int a=0,am=0,aw=0,b=0,bm=0,bw=0,c=0,cm=0,cw=0,d=0,dm=0,dw=0,e=0,em=0,ew=0,f=0,fm=0,fw=0;
FILE *fp=fopen("ѧԺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.txt","w+");
char z[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ";
char y[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ";
char x[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧԺ";
char w[]="<EFBFBD><EFBFBD>еѧԺ";
char v[]="<EFBFBD><EFBFBD>ľѧԺ";
char u[]="<EFBFBD><EFBFBD>óѧԺ";
a=zongfen(z);
b=zongfen(y);
c=zongfen(x);
d=zongfen(w);
e=zongfen(v);
f=zongfen(u);
fprintf(fp,"%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",z,a);
fprintf(fp,"%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",y,b);
fprintf(fp,"%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",x,c);
fprintf(fp,"%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",w,d);
fprintf(fp,"%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",v,e);
fprintf(fp,"%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",u,f);
fclose(fp);
printf("%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",z,a);
printf("%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",y,b);
printf("%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",x,c);
printf("%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",w,d);
printf("%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",v,e);
printf("%s<><73><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>%d\n",u,f);
}
void menu()
{
int choice1;
char choice2;
do{
printf(" =====================<3D>˶<EFBFBD>Ա<EFBFBD><D4B1>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ϵͳ======================\n\n");
printf("\t1.<2E><><EFBFBD><EFBFBD> 2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ\n");
printf("\t3.<2E><>¼ 4.<2E>ɼ<EFBFBD><C9BC>Ǽ<EFBFBD>\n");
printf("\t5.<2E>ɼ<EFBFBD><C9BC><EFBFBD>ѯ 6.<2E><><EFBFBD><EFBFBD>\n");
printf("\t7.<2E>˳<EFBFBD> \n");
printf("\t================================================\n");
printf("\n\n<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><1-8>:");
scanf("%d",&choice1);
switch(choice1)
{
case 1:
system("cls");
sign_up();
break;
case 2:
system("cls");
bmchaxun();
break;
case 3:
system("cls");
jianlu();
break;
case 4:
system("cls");
dengji();
break;
case 5:
system("cls");
cjcx();
break;
case 6:
system("cls");
paixu();
break;
}
}while(0);
}
int main(void)
{
system("color 3f");
menu();
}