記得以前碰到過這樣一個問題。 不調(diào)用系統(tǒng)函數(shù), 不使用 if else 語句, 也不能使用三目運算符。 將三個實數(shù)排序, 有這樣一種解法。。
#include <stdio.h>

int main()


{
double a,b,c;
while( scanf("%lf%lf%lf", &a, &b, &c)!= EOF )

{
double t;
a> b && (t= a, a= b, b= t);
a> c && (t= a, a= c, c= t);
b> c && (t= b, b= c, c= t);

printf("%lf\n%lf\n%lf\n", a, b, c );
}
return 0;
}
posted on 2008-11-05 16:21
Darren 閱讀(90)
評論(0) 編輯 收藏 引用