标签:style blog http java color io
1 #include <stdio.h> 2 3 int main(void) 4 { 5 int a,b,c; 6 int temp; 7 printf("please input a b c\n"); 8 scanf("%d %d %d",&a,&b,&c); 9 10 if(a>b) 11 { 12 temp=a; 13 a=b; 14 b=temp; 15 16 } 17 if(a>c) 18 { 19 temp=c; 20 c=a; 21 a=temp; 22 } 23 if(b>c) 24 { 25 temp=b; 26 c=b; 27 b=temp; 28 } 29 30 printf("%d %d %d",a,b,c); 31 32 return 0; 33 }
属于交换类排序但非冒泡型。运行结果如下:
标签:style blog http java color io
原文地址:http://www.cnblogs.com/xiaoying1245970347/p/3702989.html