
int main()
{
double a=0.0,b=0.0,c=0.0,d=0.0;
scanf("%lf %lf %lf %lf",&a,&b,&c,&d);
double temp;
if(a<b){
temp=a;
a=b;
b=temp;
}
if(b<c){
temp=b;
b=c;
c=temp;
}
if(c<d){
temp=d;
d=c;
c=temp;
}
if(b<c){
temp=b;
b=c;
c=temp;
}
if(a<b){
temp=a;
a=b;
b=temp;
}
printf("%lf %lf %lf %lf\n",a,b,c,d);
return 0;
}
#include<stdio.h>
int main()
{
int a, b, c, d, m;
printf("输入四个整数:\n");
scanf("%d%d%d%d", &a, &b, &c, &d);
if (b > a)
{
m = a; a = b; b = m;
}
else if (c > b) { m = c; c = b; b = m; }
if (d > c)
{
m = d; d = c; c = m;
} /*至此d成了最小的*/
if (b > a)
{
m = a; a = b; b = m;
}
if (c > b)
{
m = c; c = b; b = m;
} /*至此c成为次小的*/
if (b > a)
{
m = a; a = b; b = m;
} /*至此a≥b≥c≥d*/
printf("%d %d %d %d", a, b, c, d);
return;
}