当前位置:网站首页>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;
}

边栏推荐
- Some thoughts on small program subcontracting and verification of uiniapp subcontracting optimization logic
- 81. search rotation sort array II
- Sentinel source code analysis Chapter 9 - core process - lookprocesschain finding resource processing chain
- 【机器学习Q&A】数据抽样和模型验证方法、超参数调优以及过拟合和欠拟合问题
- Varnish 基础概览8
- The first technology podcast month will be launched soon
- Statsmodels notes STL
- Analysis of natural frequency and buckling load of cylinder by finite element method
- c语言期末不挂科(上)
- App test related tools
猜你喜欢

Online sql to CSV tool

Preliminary understanding of NVIDIA Jetson nano

Pytroch Learning Notes 6: NN network layer convolution layer

Embedded exit (review and release)

cookie加密8

浅析现代Web端im即时通讯开发技术

The first technology podcast month will be launched soon

【论文写作】英文论文写作指南

英伟达Jetson Nano的初步了解

R language linear regression model fitting diagnosis outliers analysis of domestic gas consumption and calorie examples with self-test questions
随机推荐
How does webapi relate to the database of MS SQL?
“乘风破浪”的芒果超媒,能上岸吗?
c语言选择,循环概述
Internal class usage scenarios, syntax and principle explanations
Machine learning notes: time series decomposition STL
Seata et les trois plateformes travaillent main dans la main pour programmer Summer, un million de bonus vous attend
post请求出现WebKitFormBoundaryk的解决办法
Application of pointer in STC89C52 single chip microcomputer and demonstration of practical cases
Clean, talk, bring children, and get rid of the label of "artificial mental retardation" for the sweeper
Sentinel source code analysis Part 7 - sentinel adapter module - Summary
STC89C52 single chip microcomputer simple calculator design and code demonstration
cookie加密9
城市规划馆在设计制作上需要注意什么
Quality management of functional modules of MES management system
Kwai reached out to the "supply side" to find the "source" of live broadcast e-commerce?
存储引擎分析
The first unlucky person watching eth 2.0
Kubernetes 核心对象概览详解
postman 之接口关联
ES6 one line code for array de duplication