日志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; }