大家给看看程序呗
/*2012年9月30日11:34:10
目的:四个数字按降序排列
*/
# include <stdio.h>
int main(void)
{
while (1)
{
int a;
int b;
int c;
int d;
int k;
printf("请输入四个数:(中间用空格分隔)\n");
scanf("%d %d %d %d", &a, &b, &c, &d);
if (a < b)
{
k = a;
a = b;
b = k;
}
if (a < c)
{
k = a;
a = c;
c = k;
}
if (a < d)
{
k = a;
a = d;
d = a;
}
if (b < c)
{
k = b;
b = c;
c = k;
}
if (b < d)
{
k = b;
b = d;
d = k;
}
if (c < d)
{
k = c;
c = d;
d = k;
}
printf("此四数降序为:");
printf("%d %d %d %d\n", a, b, c, d);
}
return 0;
}
[ 本帖最后由 gaolongtou 于 2012-9-30 12:31 编辑 ]