#include <stdio.h>
#include <iostream>
  

  
int main()
{
    int n=0;
    int score =0;
    int score_hight = 0;
    int score_low = 101;
    char name [10]={0};
    char name_low [10]={0};
    char name_hight [10]={0};
    char id [10]={0};
    char id_low [10]={0};
    char id_hight [10]={0};
    scanf("%d",&n);
    for(int i=0;i<n;++i)
    {
        scanf("%s%s%d",name,id,&score);
        if(score > score_hight )
        {    score_hight = score ;
            sprintf(name_hight,"%s",name);
            sprintf(id_hight,"%s",id);
        }
        if(score < score_low )
        {
            score_low = score;
            sprintf(name_low,"%s",name);
            sprintf(id_low,"%s",id);
        }
        
    }

    printf("%s %s\n",name_hight,id_hight);
    printf("%s %s\n",name_low,id_low);

    return 0;

}

 

  sprintf(name_low,"%s",name);  感觉
sprintf的功能就是将一个字符数组赋值到另外一个数组

相关文章:

  • 2021-11-14
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-06-30
  • 2021-11-07
  • 2022-12-23
猜你喜欢
  • 2021-10-18
  • 2021-07-12
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
相关资源
相似解决方案