当前位置:网站首页>C语言中的排序,实现从小到大的数字排序法
C语言中的排序,实现从小到大的数字排序法
2022-07-04 06:19:00 【喜欢吃火锅的泪】
摘要:对于项目开发,有时候想要对一个ADC采集的电压进行排序,然后得出稳定的ADC值,则需要对排序是必不可少的。
get_value[10] = {23,10,9,75,22,33,0,8,6,20};
int main(void)
{
for (uint8_t i = 1; i < 10; i ++)
{
for (uint8_t j = 0; j < 10 - i; j ++)
{
if (get_value[j] > get_value[j + 1])
{
tmp = get_value[j];
get_value[j] = get_value[j + 1];
get_value[j + 1] = tmp;
}
}
}for(uint8_t i = 0;i<10;i++)
{
printf("get_value[%d] = %d ,",i,get_value[i]);
}
}
结果:
0,6,8,9,10,20,22,23,33,75,
边栏推荐
- APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
- Nexus 6p从8.0降级6.0+root
- Kubernets first meeting
- How to realize multi account login of video platform members
- How to determine whether an array contains an element
- How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?
- Lightroom import picture gray / Black rectangular multi display
- [openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
- The end of the Internet is rural revitalization
- 如何判断数组中是否含有某个元素
猜你喜欢

Review | categories and mechanisms of action of covid-19 neutralizing antibodies and small molecule drugs
![[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx](/img/a9/72791cbcc6c9da45e89450ab2820c1.jpg)
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx

C语言中的函数(详解)

Learn about the Internet of things protocol WiFi ZigBee Bluetooth, etc. --- WiFi and WiFi protocols start from WiFi. What do we need to know about WiFi protocol itself?

HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)

gslb(global server load balance)技术的一点理解

How to use multithreading to export excel under massive data? Source code attached!

js如何将秒转换成时分秒显示

Reading notes of Clickhouse principle analysis and Application Practice (4)

Arcpy 利用updatelayer函数改变图层的符号系统
随机推荐
Design and implementation of tcp/ip series overview
JS扁平化数形结构的数组
How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
2022.7.3-----leetcode.556
High performance parallel programming and optimization | lesson 02 homework at home
Manually page the list (parameter list, current page, page size)
Kubernets first meeting
How to get the parent node of all nodes in El tree
《ClickHouse原理解析与应用实践》读书笔记(4)
px em rem的区别
4G wireless all network solar hydrological equipment power monitoring system bms110
How to help others effectively
QT get random color value and set label background color code
webrtc 快速搭建 视频通话 视频会议
How to realize multi account login of video platform members
APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
Kubernets first meeting
Tutle clock improved version
双色球案例
R统计绘图-随机森林分类分析及物种丰度差异检验组合图