乙_1004 成绩排名 (20分)

 分析: 使用字符串拼接

#include <iostream>
#include <cstring>
using namespace std;
int main(){
 int score;
 string  tem1,tem2, stuma , stumi;
 int max=-1 ,  min=10000;
int n;
cin >> n;
while(n--){
 cin>> tem1>> tem2>>score;
 if(score>max) {
  max=score;
  stuma= tem1+ " "+ tem2;
 }
 if(score < min){
  min=score; 
  stumi= tem1+ " "+ tem2;
 }
 }
 cout << stuma<< endl ;
    cout<< stumi << endl;
 system("pause"); 
 return 0;
}

猜你喜欢

转载自www.cnblogs.com/xueshadouhui/p/12938875.html