首页 > 代码库 > PAT Basic Level 1004
PAT Basic Level 1004
1 #include <stdio.h> 2 struct student 3 { 4 int score; 5 char nameChar[11]; 6 char stunoChar[11]; 7 }; 8 int main () 9 { 10 struct student student[1000]; 11 int count = 0; //测试数量 12 scanf("%d",&count); 13 int i = count-1; 14 while (i>=0) 15 { 16 scanf("%s",&student[i].nameChar); 17 scanf("%s",&student[i].stunoChar); 18 scanf("%d",&student[i].score); 19 i--; 20 } 21 int max = student[0].score; 22 int min = student[0].score; 23 int maxNo = 0; 24 int minNo = 0; 25 i = count-1; 26 while (i >= 0) 27 { 28 if(student[i].score>max) 29 { 30 max = student[i].score; 31 maxNo = i; 32 } 33 if(student[i].score<min) 34 { 35 min = student[i].score; 36 minNo = i; 37 } 38 i--; 39 } 40 printf("%s %s\n",student[maxNo].nameChar,student[maxNo].stunoChar); 41 printf("%s %s",student[minNo].nameChar,student[minNo].stunoChar); 42 return 0; 43 44 45 }
PAT Basic Level 1004
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。