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 }
结构体的应用-成绩录入初步
最新推荐文章于 2025-12-04 16:55:26 发布
本文介绍了一个使用C语言编写的简单程序,该程序能够读取学生的编号、姓名和成绩,并找出最高分和最低分的学生信息。通过定义结构体来组织数据,并利用循环和条件判断实现了基本的数据处理功能。
1454

被折叠的 条评论
为什么被折叠?



