#include<iostream>
#include<string>
#include<sstream>
using namespace std;
class Student_grade
{
public:
Student_grade() = default;
Student_grade(istream &in)
{
in >> name >> id >> grade;
}
Student_grade(const unsigned g):grade(g){}
unsigned get_grade() const { return grade; }
void print()const { cout << name << " " << id << endl; }
private:
string name;
string id;
unsigned grade=0;
};
int main()
{
unsigned n = 0;
cin >> n;
Student_grade max;
Student_grade min(100);
while (n>0)
{
Student_grade st(cin);
if (max.get_grade() <= st.get_grade())
max = st;
if (min.get_grade() >= st.get_grade())
min = st;
--n;
}
max.print();
min.print();
system("pause");
return 0;
}
网友评论