#include "stdio.h"
#define N 3
struct student
{ int num;
char name[12];
int score;
};
main( )
{ FILE fp;
struct student s[N],*p;
int i,j,k;
if((fp=fopen("bc7_4.out","w"))==NULL)
{ printf("cannot open the file\n");
exit(0); }
printf (" Input %d student's num name score\n",N);
p=s;
for (i=0;i<N;i++) / 输入 /
{ scanf("%d%s%d",&p->num,p->name,&p->score);
p++;
}
paixu(s,N);
p=s;
for (i=0;i<N;i++,p++) / 输出 */
{printf("按成绩降序排列后:\n%6d%10s%6d\n",p->num,p->name,p->score);
fprintf(fp," 按成绩降序排列后:\n %6d%10s%6d\n",p->num,p->name,p->score);
}
fclose(fp);
system("pause");
}
paixu(struct student *p,int n)
{
}