#include<iostream>
using namespace std;
struct student
{
string name;
double score;
};
int main()
{
student stu[5],s;
for(int i=0; i<5; i++)
{
cin>>stu[i].name>>stu[i].score;
}
for(int i=0; i<5; i++)
{
for(int j=i+1; j<5; j++)
{
if(stu[i].score>stu[j].score)
{
s=stu[j];
stu[j]=stu[i];
stu[i]=s;
}
}
}
cout<<"MAX: "<<stu[4].name<<" "<<stu[4].score<<endl;
cout<<"MIN:"<<stu[0].name<<" "<<stu[0].score<<endl;
return 0;
}
chengji
最新推荐文章于 2021-02-01 10:41:50 发布