当前位置:网站首页>C语言 成绩排名
C语言 成绩排名
2022-06-30 01:25:00 【Martin の Blog】

算法设计思路
- 定义一个结构体,其中包括:name、id以及score
- 对score进行排序,找出最大和最小值
- 按照最大和最小值打印name和id
代码
#include <stdio.h>
struct student{
char name[100];
char id[100];
int score;
};
int main(){
struct student st[100], max, min;
max.score = -1;
min.score = 100;
int n, i;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%s %s %d", st[i].name, st[i].id, &st[i].score);
}
for(i=0; i<n; i++){
if(st[i].score > max.score){
max = st[i];
}
if(st[i].score < min.score){
min = st[i];
}
}
printf("%s %s\n%s %s\n", max.name, max.id, min.name, min.id);
return 0;
}

边栏推荐
- Solving plane stress problem with MATLAB
- Varnish 基础概览5
- Sentinel source code analysis Chapter 9 - core process - lookprocesschain finding resource processing chain
- GeoTools WKT坐标系转换
- MySQL function
- The 8th "Internet +" competition - cloud native track invites you to challenge
- [mrctf2020]ezpop-1 | PHP serialization
- Twitter launches the test of anti abuse tool "safe mode" and adds enabling prompt
- Cub school learning: manual query and ADC in-depth use
- Kwai reached out to the "supply side" to find the "source" of live broadcast e-commerce?
猜你喜欢

一文读懂,MES管理系统模块功能

Kwai reached out to the "supply side" to find the "source" of live broadcast e-commerce?

Questions about database: database attachment

Statsmodels notes STL

js逆向请求参数加密:

Cloud, IPv6 and all-optical network

3-6sql injection website instance step 5: break through the background to obtain web administrator permissions

cookie加密8

Pytroch Learning Notes 6: NN network layer convolution layer

Seata and the three platforms are working together in the summer of programming. Millions of bonuses are waiting for you
随机推荐
Mysql 监控2
Varnish 基础概览3
阅读,是最廉价的高贵
Understanding of int argc, char * * argv in C language main function
挖财的课程靠谱吗,让开户安全吗?
Solving plane stress problem with MATLAB
The first technology podcast month will be launched soon
JS anti shake and throttling
Statsmodels notes STL
Visual studio 2017 cannot open the include file: 'qopenglfunctions_3_3_core': no such file or directory
Varnish 基础概览1
Precautions for postoperative fundus hemorrhage / / must see every day
Mysql 监控1
GeoTools WKT坐标系转换
JS prototype and prototype chain (Lantern Festival meal)
Varnish 基础概览6
Quality management of functional modules of MES management system
传统微服务框架如何无缝过渡到服务网格 ASM
RubyMine开发工具,重构和意图操作
Kubernetes 核心对象概览详解