文章
119
粉丝
68
获赞
92
访问
20.2k
#include <bits/stdc++.h>
using namespace std;
struct Student{
string id,clas,name;
double score1,score2,score3,pre;
Student(string id,string clas,string name,double score1,double score2,double score3):id(id),clas(clas),name(name),score1(score1),score2(score2),score3(score3){
pre=(score1+score2+score3)/3.0;
}
bool operator <(Student b){
return pre<b.pre;
}
void print(){
cout<<id<<' '<<clas<<' '<<name<<' ';
printf("%.1lf %.1lf %.1lf %.1lf",score1,score2,score3,pre);
}
};
int main() {
int n;
while(cin>>n){
std::vector<Student> a;
while(n--){
string id,clas,name;
double score1,score2,score3;
cin>>id>>clas>>name>>score1>>score2>>score3;
a.push_back(Student(id,clas,name,score1,score2,score3));
cout<<a[a.size()-1]...
登录后发布评论
暂无评论,来抢沙发