刚刚才学了这个内容,这个是自已写的程序,不知道错哪了,应该怎么改?求大神教我怎么改

题目请输入三个整数,并把它们从小到大排序好

思路没有错,但有6种情况呢,你只写出了3种。交换数值排序较简单点——

代码文本:

#include "stdio.h"

int main(int argc,char *argv[]){

int a,b,c,t;

printf(":lease input three number:");

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\n",a,b,c);

return 0;

}

温馨提示:答案为网友推荐,仅供参考
相似回答