日志19

学生成绩输入及统计输出

#include<iostream>
#include<string>
using namespace std;
struct Student{
    string name;
    int programmingScore;
    int mathScore;
    int englishScore;
};
int main(){
    int n;
    cin>>n;
    Student students[n];
    for(int i=0;i<n;i++){
        cin>>students[i].name>>students[i].programmingScore>>students[i].mathScore>>students[i].englishScore;
    }
    for (int i=0;i<n;i++){
        int totalScore=students[i].programmingScore+students[i].mathScore+students[i].englishScore;
        cout<<students[i].name<<" "<<totalScore<<endl;
    }
    return 0;
}

全部评论

相关推荐

vip牛牛:测试吧,开发现在至少212
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务