当前位置:网站首页>C language: structure array implementation to find the lowest student record
C language: structure array implementation to find the lowest student record
2022-06-24 00:17:00 【Nianchi ichthyology programming】

#include <stdio.h>
#include <string.h>
#define N 10
typedef struct ss
{
char num[N];
int s;
}STU;
void fun(STU a[] , STU *s);
int main()
{
STU a[N]={
{
"A01",81},{
"A02",89},{
"A03",66},{
"A04",87},{
"A05",77},{
"A06",90},{
"A07",79}
,{
"A08",61},{
"A09",90},{
"A10",77}},m;
int i;
printf("************* Raw data ****************\n");
for(i = 0 ; i < N ; i++){
printf(" Student number = %s , achievement = %d\n",a[i].num , a[i].s);
}
fun(a,&m);
printf("************* The result is ****************\n");
printf(" Student number of the student with the lowest score = %s , achievement = %d\n",m.num , m.s);
return 0;
}
void fun(STU a[] , STU *s)
{
int i;
strcpy(s->num,a[0].num);
s->s = a[0].s;
for(i = 0 ; i < N ; i++){
if(s->s>a[i].s){
strcpy(s->num,a[i].num);
s->s=a[i].s;
}
}
}
边栏推荐
- Accompanist组件库中文指南 - Glide篇,劲爆
- 如何入门机器学习?
- Expander+listbox of WPF effect
- Return, const, volatile keywords
- [image detection saliency map] calculation of fish eye saliency map based on MATLAB distortion prompt [including Matlab source code 1903]
- After the deployment of Beidou navigation system, why didn't we launch a high-precision map similar to Google maps?
- Learn PWN from CTF wiki - ret2text
- [interview experience package] summary of experience of being hanged during interview (I)
- 产业互联网时代将依靠源自于产业本身的产品、技术和模式来实现的
- Complete collection of development environment configuration -- Visual Studio 2022 installation
猜你喜欢

C语言:结构体数组实现找出最低分学生记录

CPU取指到发出控制、微程序控制原理详细过程

Learn PWN from CTF wiki - ret2text

【红绿灯识别】基于matlab GUI红绿灯识别【含Matlab源码 1908期】

Revit API: schedule viewschedule

What do NLP engineers do? What is the work content?

Leetcode - linked list written test questions

Chinese guide to accompanist component library - glide, hot

Complete open source project poetry bar app

Save: software analysis, verification and test platform
随机推荐
Detailed process from CPU fetching to sending control and microprogram control principle
Dependency Inversion Principle
Activity 的 36 大难点,你会几个?,安卓面试2020
Chaos engineering, learn about it
解决base64压缩文件,经过post请求解压出来是空格的问题
国内首款开源MySQL HTAP数据库即将发布,三大看点提前告知 石原子科技重磅推出
元宇宙中的社会秩序
逆向工具IDA、GDB使用
数字化工厂可以分为哪两类
产业互联网时代将依靠源自于产业本身的产品、技术和模式来实现的
C语言:利用自定义函数排序
First week of summer vacation
Usage of go in SQL Server
超标量处理器设计 姚永斌 第3章 虚拟存储器 --3.1~3.2 小节摘录
Six necessary open source projects for private activities
JS language precision problem
Basic usage of oushudb database (medium)
Tiktok practice ~ one click registration and login process of mobile phone number and password (restrict mobile terminal login)
Design of message push platform
Keywords such as extern and struct