标签:img core inf names 基本 bsp mic struct return
#include <bits/stdc++.h> using namespace std; struct Student{ string id;// 学号 string name;// 姓名 int score;// 成绩 }max_s, min_s; int main(int argc, char *argv[]) { int n, score; string name, id; cin >> n; // init max_s.score = -1; min_s.score = 101; for(int i = 0; i < n; i++){ cin >> name >> id >> score; if(score > max_s.score){ max_s.name = name; max_s.id = id; max_s.score = score; } if(score < min_s.score){ min_s.name = name; min_s.id = id; min_s.score = score; } } cout << max_s.name << ‘ ‘ << max_s.id << endl; cout << min_s.name << ‘ ‘ << min_s.id << endl; return 0; }
标签:img core inf names 基本 bsp mic struct return
原文地址:https://www.cnblogs.com/YC-L/p/12267470.html