一、题目描述:
二、代码展示:
#include <iostream>
#include <iomanip>
using namespace std;
struct Student{char name[20];int id;int age;float score;
};
int main()
{int n;cin>>n;Student student[n];float sum=0.0;for(int i=0;i<n;i++){cin>>student[i].name>>student[i].id>>student[i].age>>student[i].score;sum=sum+student[i].score;}float averagescore=sum/n;cout << fixed << setprecision(2) << averagescore << endl; //结果保留两位小数return 0;
}