当前位置:网站首页>C语言:利用自定义函数排序
C语言:利用自定义函数排序
2022-06-23 22:24:00 【念迟鱼学编程】

#include <stdio.h>
void fun(float *p,float *q , float *s);
int main()
{
float a,b,c;
printf("请输入三个小数a,b,c:\n");
scanf("%f%f%f",&a,&b,&c);
printf("这三个数分别为:\n");
printf("a = %4.1f,b = %4.1f,c = %4.1f\n\n",a,b,c);
fun(&a,&b,&c);
printf("按从大到小排序后的这三个数为:\n");
printf("a = %4.1f,b = %4.1f,c = %4.1f\n\n",a,b,c);
return 0;
}
void fun(float *p,float *q , float *s)
{
float k;
if(*p<*q){
k = *p;
*p = *q;
*q = k;
}
if(*p<*s){
k = *p;
*p = *s;
*s = k;
}
if(*q<*s){
k = *q;
*q = *s;
*s = k;
}
}
边栏推荐
- Docker deploy redis
- 人工智能技术岗位面试要注意什么?
- How much business do you need to know to do data analysis
- [technical grass planting] the tail of the "double 11" event. Let's talk about how much discount the message push service package is!
- Batch renaming of images by MATLAB
- 国内首款开源MySQL HTAP数据库即将发布,三大看点提前告知 石原子科技重磅推出
- Total number of combinations ii[each element can only be solved by + once]
- 【面试经验包】面试被吊打经验总结(一)
- NLP工程师是干什么的?工作内容是什么?
- What is the difference between concurrency and parallelism?
猜你喜欢

kubernetes之常用核心资源对象

Three types of transactions in EF core (saveChanges, dbcontexttransaction, transactionscope)

AI技术在医学领域有什么用?

Android AIDL:跨进程调用Service (AIDL Service),kotlininvoke函数

国内首款开源MySQL HTAP数据库即将发布,三大看点提前告知 石原子科技重磅推出

Andorid development art exploration notes (2), cross platform applet development framework

Keywords such as extern and struct

合成大西瓜小游戏微信小程序源码/微信游戏小程序源码
![[FreeRTOS] 07 binary semaphore and count semaphore](/img/9c/a3e4b9e02f754c5d3a54d94b7b4e35.png)
[FreeRTOS] 07 binary semaphore and count semaphore
![Restore IP address [standard backtracking + standard pruning]](/img/e6/5f9d2a5af973b6c7051ed434a4b93d.png)
Restore IP address [standard backtracking + standard pruning]
随机推荐
Cloud native architecture (05) - Application Architecture Evolution
Test - use case - detail frenzy
Andorid development art exploration notes (2), cross platform applet development framework
Leetcode - linked list written test questions
数据库中索引原理及填充因子
[traffic light identification] traffic light identification based on Matlab GUI [including Matlab source code 1908]
What is the future development of palmprint recognition technology?
【图像检测显著图】基于matlab失真提示鱼眼图显著图计算【含Matlab源码 1903期】
Common WebGIS Map Libraries
Go language core 36 lectures (go language practice and application 11) -- learning notes
依赖倒置原则
Android AIDL:跨进程调用Service (AIDL Service),kotlininvoke函数
Restore IP address [standard backtracking + standard pruning]
Kubernetes basic concept
Design of message push platform
Tiktok practice ~ one click registration and login process of mobile phone number and password (restrict mobile terminal login)
Vulnerability recurrence - redis vulnerability summary
Android 3年外包工面试笔记,有机会还是要去大厂学习提升,作为一个Android程序员
Jeecgboot old version 2 x 3. X how to integrate building block reports?
Principles and differences between hash and history