当前位置:网站首页>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;
}
}
边栏推荐
- WPF效果之Expander+ListBox
- Perfectionist win10 installation guide
- Android App Bundle探索,客户端开发面试题目
- Another short video app with high imitation and eye opening
- What is the difference between overload and override?
- Restore IP address [standard backtracking + standard pruning]
- [digital signal] spectrum refinement based on MATLAB analog window function [including Matlab source code 1906]
- Andorid development art exploration notes (2), cross platform applet development framework
- UART协议时序总结
- Tiktok practice ~ one click registration and login process of mobile phone number and password (restrict mobile terminal login)
猜你喜欢

2. camera calibration

Test - use case - detail frenzy

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

Don't miss | Huawei's internal data - Successful Project Management PPT (page 123)

985本3Android程序员40天拿下阿里P6口头offer,面试成功后整理了这些面试思路

Facebook open source shimmer effect

Keywords such as extern and struct

Docker deploy redis

量化投资模型——高频交易做市模型相关(Avellaneda & Stoikov’s)研究解读&代码资源

抖音实战~手机号密码一键注册登录流程(限制手机终端登录)
随机推荐
First week of summer vacation
[new cos series] | object storage cos data Vientiane CI processing special data processing resource package 4.5 folded into a big gift package!
What is medical treatment? AI medical concept analysis AI
Dot and cross product
Shutter control layout
Android 3年外包工面试笔记,有机会还是要去大厂学习提升,android开发实习面试题
Usage of go in SQL Server
Another short video app with high imitation and eye opening
暑假第一周
String s = new string ("XYZ") how many string objects are created?
Salesforce batch apex batch processing (V) asyncapexjob intelligence
Startup process analysis of APP performance optimization
数据库中索引原理及填充因子
Principles and differences between hash and history
What is the future development of palmprint recognition technology?
Design of message push platform
Facebook open source shimmer effect
C语言c89(c90)的所有的32个关键字分类
抖音实战~密码找回
国内首款开源MySQL HTAP数据库即将发布,三大看点提前告知 石原子科技重磅推出