c语言编程的题 “从键盘输入3个数,使其按从小到大的顺序排列输出。” 感谢各位帮忙!

拜托!

第1个回答  推荐于2016-03-30
#include<stdio.h>

void sort(int &a,int &b)//对两个数进行排序
{
int d;
if(a>b)
{
d=a;a=b;b=d;
}

}

void main()
{
int a,b,c,d;
printf("输入三个数");
scanf("%d%d%d",&a,&b,&c);
sort(a,b);
sort(a,c);
sort(b,c);
printf("%d %d %d",a,b,c);
}本回答被提问者采纳
第2个回答  2008-02-27
#include <stdio.h>

int mian()
{
double number1,number2,number3;
double max,min,middle;

printf("In put three number:\n");
scanf("%l %l %l",&number1,&number2,&number3);

max = number3>(number1>number2?number1:number2)?number3:(number1>number2?number1:number2);

min = number3<(number1<number2?number1:number2)?number3:(number1>number2?number1:number2);

middle = number3>(number1<number2?number1:number2)?number3:(number1>number2?number1:number2);

printf("%l < %l < %l",min,middle,max);
return 0;
}
第3个回答  2008-02-27
........同意楼上,您翻下书吧,肯定有.....
第4个回答  2008-02-27
这是个最简单的,简单到我都不想再写了……