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.

112 lines
2.7 KiB

6 years ago
#include"c1.cpp"
void section() //ѧ<><D1A7><EFBFBD>ɼ<EFBFBD><C9BC>ֶ<EFBFBD>
{
system("cls");
int k=0;
double c;
if((fp=fopen("a.txt","r"))==NULL)
{
printf("Cannot open the file!\n");
}
while(fscanf(fp,"%lf%s%f",&s[k].no,s[k].name,&s[k].cscore)!=EOF)
{
k++;
}
printf("\t\t\t 90<39><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ!\n");
for(i=0;i<k;i++)
if(s[i].cscore>=90)
printf("\t\t\t%.0lf %s %.1f\n",s[i].no,s[i].name,s[i].cscore);
printf("\n\n");
printf("\t\t\t 80<38><30>89<38><39>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ!\n");
for(i=0;i<k;i++)
if(s[i].cscore<90&&s[i].cscore>=80)
printf("\t\t\t%.0lf %s %.1f\n",s[i].no,s[i].name,s[i].cscore);
printf("\n\n");
printf("\t\t\t 60<36><30>79<37><39>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ!\n");
for(i=0;i<k;i++)
if(s[i].cscore>=60&&s[i].cscore<80)
printf("\t\t\t%.0lf %s %.1f\n",s[i].no,s[i].name,s[i].cscore);
printf("\n\n");
printf("\t\t\t 60<36><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ!\n");
for(i=0;i<k;i++)
if(s[i].cscore<60)
printf("\t\t\t%.0lf %s %.1f\n",s[i].no,s[i].name,s[i].cscore);
printf("\n\n");
}
void rank() //<2F>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
Student t;
int k=0;
double sum=0,j=0;
system("cls");
if((fp=fopen("a.txt","r"))==NULL)
{
printf("Cannot open the file!\n");
}
while(fscanf(fp,"%lf%s%f",&s[k].no,s[k].name,&s[k].cscore)!=EOF)
{
k++;
}
for(i=0;i<k;i++)
for(int j=i+1;j<k+1;j++)
if(s[i].cscore<s[j].cscore)
{t=s[i];s[i]=s[j];s[j]=t;}
for(i=0;i<k;i++)
{
if(s[i].cscore>=60)
j++;
}
for(i=0;i<k;i++)
sum=sum+s[i].cscore;
for(i=0;i<k;i++)
printf("\t\t\t<EFBFBD><EFBFBD>%d<><64>:%.0lf %-4s %.1f\n",i+1,s[i].no,s[i].name,s[i].cscore);
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD>:%.1lf\n",s[0].cscore);
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>:%.1lf\n",s[k-1].cscore);
printf("\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%.2lf\n",j/k);
printf("\t\t\tƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%.2lf\n",sum/k);
}
void choose(int n) //Ŀ¼<C4BF><C2BC>ѡ<EFBFBD><D1A1>
{
system("cls");
int y;
switch(n)
{
case 1:input();
printf("\n\n\n\n\t\t\t<EFBFBD>Ƿ񷵻أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%d",&y);
if(y==1)
choose(fun());break;
case 2:output();
printf("\n\n\n\n\t\t\t<EFBFBD>Ƿ񷵻أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%d",&y);
if(y==1)
choose(fun());break;
case 3:modify();
printf("\n\n\n\n\t\t\t<EFBFBD>Ƿ񷵻أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%d",&y);
if(y==1)
choose(fun());break;
case 4:lookat();
printf("\n\n\n\n\t\t\t<EFBFBD>Ƿ񷵻أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%d",&y);
if(y==1)
choose(fun());break;
case 5:section();
printf("\n\n\n\n\t\t\t<EFBFBD>Ƿ񷵻أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%d",&y);
if(y==1)
choose(fun());break;
case 6:rank();
printf("\n\n\n\n\t\t\t<EFBFBD>Ƿ񷵻أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%d",&y);
if(y==1)
choose(fun());break;
case 7:exit(0);break;
default:printf("\n\n\t\t\t <20><><EFBFBD><EFBFBD>û<EFBFBD>е<EFBFBD>ѡ<EFBFBD><EFBFBD><EEA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
choose(fun());
}
}