该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include #include struct student{ char num[10]; char name[8]; int score[3]; float ave; }st[10],s; void main(){ FILE *fp,* fp1; int i,j,t,n; printf("\nNo.: "); scanf("%s",s.num ); printf("name: "); scanf("%s",s.name ); printf("score1,score2,score3: "); scanf("%d,%d,%d",&s.score[0],&s.score[1],&s.score[2]); s.ave=(s.score[0]+s.score[1]+s.score[2])/3.0; if((fp=fopen("stu_sort","w"))==NULL) { printf("can not open file."); exit(0); }printf("Original data:\n"); for(i=0;fread(&st[i],sizeof(struct student),1,fp)!=0;i++) { printf("\n%8s%8s",st[i].num ,st[i].name ); for(j=0;j<3;j++) printf("%8d",st[i].score [j]); printf("%10.2f",st[i].ave ); } n=i; for(t=0;st[t].ave >s.ave &&t
}
2图代码。
就是输入不了数据。不知为什么?求助