1004 成绩排名 (20)(20 分)

#include
#include
#include
using namespace std;
const int maxn = 1e3 + 10;
struct str {
    string name, num;
    int score;
}a, high, low;
int n;
int main()
{
    high.score = 0;
    low.score = 100;
    scanf("%d", &n);
    while (n--)
    {
        cin >> a.name >> a.num >> a.score;
        if (a.score > high.score)high = a;
        if (a.score < low.score)low = a;
    }
    cout << high.name << " " << high.num << endl;
    cout << low.name << " " << low.num << endl;
    return 0;
}

你可能感兴趣的:(1004 成绩排名 (20)(20 分))