#include <stdio.h>
#include <stdlib.h>
struct student{
char id[11];
double mid ;
double end ;
double sum ;
};
int main()
{
FILE *fp;
int n,i;
struct student stu[100];
i=0;
scanf("%d",&n);
fp=fopen("d:\\list.txt","w");
fprintf(fp,"%s","学号 期中 期末 综合\n");
while(i<n){
scanf("%s",stu[i].id);
scanf("%lf",&stu[i].mid);
scanf("%lf",&stu[i].end);
stu[i].sum=stu[i].mid*0.3+stu[i].end*0.7;
i++;
}
i=0;
while(i<n){
fprintf(fp,"%s",stu[i].id);
fprintf(fp,"%5.0lf",stu[i].mid);
fprintf(fp,"%7.0lf",stu[i].end);
fprintf(fp,"%7.0lf",stu[i].sum);
fprintf(fp,"%c",'\n');
i++;
}
fclose(fp);
return 0;
}
网友评论