#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,c,t;
scanf("%d %d %d",&a,&b,&c);
if(a<b)
{
t=a;
a=b;
b=t;
}
if(a<c)
{
t=a;
a=c;
c=t;
}
if(b<c)
{
t=b;
b=c;
c=t;
}
printf("%d %d %d",a,b,c);
system("pause");
return 0;
}
没有问题,可能你的环境没配好
运行失败报错截图看下
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,c,t;
scanf("%d %d %d",&a,&b,&c);
if(a<b)
{
t=a;
a=b;
b=t;
}
if(a<c)
{
t=a;
a=c;
c=t;
}
if(b<c)
{
t=b;
b=c;
c=t;
}
printf("%d %d %d",a,b,c);
system("pause");
return 0;
}
在devc++上运行如图:
要不把
system("pause");
注释掉,看看能运行不