#include
#include
typedef struct stu{
int id;
char name[40];
int mark[4];
float total;
} STU;
int id;
int m1,m2,m3,m4;
char str[40];
void main()
{
int i,j,N=0;
FILE *fin, *fout;
STU tmp;
STU *s;
fin = fopen("score.txt","r");
while (1){
if ( fscanf(fin,"%*d %*s %*d %*d %*d %*d") ==EOF) break;
N++;
}
fclose(fin);
s = (STU *) malloc(N * sizeof(STU));
if (!s) {
printf("no enough memory for STU\n"); exit(0);
}
fin = fopen("score.txt","r");
for (i=0;i s[i].total){
tmp = s[j]; s[j]=s[i];s[i]=tmp;
};
};
};
fout = fopen("score_Q.txt","w");
for(i=0;i