码迷,mamicode.com
首页 > 其他好文 > 详细

结构体的应用-成绩录入初步

时间:2018-01-17 23:28:57      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:初步   结构体   div   class   printf   can   color   ring   char   

 1 #include<cstdio>
 2 #include<string>
 3 
 4 struct student{
 5     int num;
 6     char name[20];
 7     int score;
 8 };
 9 
10 int main(){
11     int i;
12     struct student st,stmax,stmin;
13     stmax.score = 0;
14     stmin.score = 100;
15     for(i=1;i<=100;i++){
16         scanf("%d%s%d", &st.num, st.name, &st.score);
17         if(st.score > stmax.score)
18         stmax = st;
19         if(st.score < stmin.score)
20         stmin = st;
21     }
22     printf("\n %5d%15s%5d", stmax.num, stmax.name, stmax.score);
23     printf("\n %5d%15s%5d", stmin.num, stmin.name, stmin.score);
24 }

 

结构体的应用-成绩录入初步

标签:初步   结构体   div   class   printf   can   color   ring   char   

原文地址:https://www.cnblogs.com/wwcjj/p/8306477.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!