哎,大一的题目都不会做了
#define M 5 /*设一共有5个学生*/ #define N 6 /*设一个学生有六门课*/ typedef struct { float score[N]; int num; /*学生学号*/ }student; main() { int i,j,k; float total,sum; student a[M]; for(i=0;i<M;i++) { printf("please input the number of %d student:\n",i); scanf("%d",&a[i].num); printf("please input the i student score:\n",i); for(j=0;j<N;j++) scanf("%f",&a[i].score[j]); printf("\n"); }
for(i=0;i<M;i++) for(j=0;j<N;j++) if(a[i].score[j]<60) {printf("the student's number is:%d\n",a[i].num); printf("his score is:"); for(k=0;k<n;k++) {printf("%d",a[i].score[k]); sum+=a[i].score[k];} printf("the average is:\n",sum/N); } }
这个有错误,谁能帮我改一下下呀,thank you 先