当前位置:网站首页>(practice C language every day) pointer sorting problem
(practice C language every day) pointer sorting problem
2022-07-04 02:53:00 【Yi Xiaoxia】
Pointer sorting problem
Input 10 Number , Sort the output by absolute value from large to small . Input form : Input 10 individual float The set of real Numbers Output form : Keep two significant digits after the decimal point ; The output is arranged from large to small
The following program realizes this function , Please fill in the blanks :
#include <math.h>
#include <stdio.h>
void paixu(float *p, int n)
{
int i, j;
for (i = 0; i < n - 1; i++)
{
for (j = 0; j < n - 1 - i; j++)
{
if (fabs(p[j]) < fabs(p[j + 1]))
{
float tmp;
tmp = p[j];
p[j] = p[j + 1];
p[j + 1] = tmp;
}
}
}
}
int main()
{
float f[10];
int i;
for (i = 0; i < 10; i++)
scanf("%f", &f[i]);
paixu(f, 10);
for (i = 0; i < 10; i++)
printf("%.2f ", f[i]);
return 0;
}边栏推荐
- Bugku Zhi, you have to stop him
- Keepalived set the master not to recapture the VIP after fault recovery (it is invalid to solve nopreempt)
- Hospital network planning and design document based on GLBP protocol + application form + task statement + opening report + interim examination + literature review + PPT + weekly progress + network to
- Network byte order
- Ai aide à la recherche de plagiat dans le design artistique! L'équipe du professeur Liu Fang a été embauchée par ACM mm, une conférence multimédia de haut niveau.
- Contest3145 - the 37th game of 2021 freshman individual training match_ D: Ranking
- Global and Chinese markets of advanced X-ray inspection system (Axi) in PCB 2022-2028: Research Report on technology, participants, trends, market size and share
- Optimization theory: definition of convex function + generalized convex function
- Node solves cross domain problems
- Sword finger offer 20 String representing numeric value
猜你喜欢

Gee import SHP data - crop image

C # learning notes: structure of CS documents

How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #

MySQL workbench use

WordPress collection WordPress hang up collection plug-in
![Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine](/img/3a/cf6285ae1c01bda42874eeca9fe5b1.jpg)
Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine

Yyds dry goods inventory override and virtual of classes in C

Setting methods, usage methods and common usage scenarios of environment variables in postman

Pagoda SSL can't be accessed? 443 port occupied? resolvent

Zblog collection plug-in does not need authorization to stay away from the cracked version of zblog
随机推荐
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
PMP 考試常見工具與技術點總結
Li Chuang EDA learning notes IX: layers
Global and Chinese market for travel wheelchairs 2022-2028: Research Report on technology, participants, trends, market size and share
Take you to master the formatter of visual studio code
Summarize the past to motivate yourself to move on
FRP intranet penetration
Lichuang EDA learning notes 14: PCB board canvas settings
(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)
Setting methods, usage methods and common usage scenarios of environment variables in postman
Save Private Ryan - map building + voltage dp+deque+ shortest circuit
查詢效率提昇10倍!3種優化方案,幫你解决MySQL深分頁問題
String: LV1 eat hot pot
Problems and solutions of several concurrent scenarios of redis
Mysql-15 aggregate function
Record a problem that soft deletion fails due to warehouse level error
CSCI 2134
Database concept and installation
Servlet simple verification code generation
Global and Chinese market of contour projectors 2022-2028: Research Report on technology, participants, trends, market size and share