#include <bits/stdc++.h>
using namespace std;
class student
{
private:
string ID;
int score;
public:
void inset()
{
cin>>ID>>score;
}
string show1()
{
return ID;
}
int show2()
{
return score;
}
};
void max1(student *p)
{
string m;
int i,n = 0;
for(i = 0;i <= 4;i++)
{
if(p[i].show2() > n)
{
n = p[i].show2();
m = p[i].show1();
}
}
cout<<m<<" "<<n<<endl;
}
int main()
{
student stu[1100];
int i;
for(i = 0;i <= 4;i++)
stu[i].inset();
max1(stu);
return 0;
}
对象指针
最新推荐文章于 2022-10-28 12:19:04 发布