题解 | #班级成绩输入输出#

班级成绩输入输出

https://www.nowcoder.com/practice/60d96b08e1cb42e38629d54e37eac008

#include <stdio.h>

typedef struct
{
    float a;
    float b;
    float c;
    float d;
    float e;
} point;
int main() {
    int i = 0;
    point stu[10];
    while ( scanf("%f %f %f %f %f", &stu[i].a, &stu[i].b, &stu[i].c, &stu[i].d, &stu[i].e)!=EOF)
    {
        i++;
    }
    int t = i;
    int total = 0;
    i = 0;
    while (total < t) {
        printf("%.1f %.1f %.1f %.1f %.1f %.1f\n", stu[i].a, stu[i].b, stu[i].c, stu[i].d, stu[i].e, stu[i].a + stu[i].b + stu[i].c + stu[i].d + stu[i].e);
        i++;
        total++;
    }
    return 0;
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务