题解 | #班级成绩输入输出#
班级成绩输入输出
https://www.nowcoder.com/practice/60d96b08e1cb42e38629d54e37eac008
#include<stdio.h> typedef struct student ss; struct student{ float score[5]; float sum; }; int main() { ss stu[5]; for(int i=0;i<5;i++){ for(int j=0;j<5;j++){ // scanf("%f ",&stu[i].score[j]);//err scanf(" %f",&stu[i].score[j]);//为什么空格到前面就好了?? } getchar(); } for(int i=0;i<5;i++){ stu[i].sum=0; for(int j=0;j<5;j++){ stu[i].sum+=stu[i].score[j]; printf("%.1f ",stu[i].score[j]); } printf("%.1f ",stu[i].sum); printf("\n"); } return 0; }