标签:style blog color io art for re c
#include<stdio.h> void selectSort(int a[],int length); void main() { int i; float start=0,finish=0; int a[10]={10,15,4,2,5,3,6,9,7,1}; printf("排序前:\n"); for(i=0;i<10;i++) printf("%d ",a[i]); printf("\n排序后:\n"); selectSort(a,10); } void selectSort(int a[],int length) { int i,j,temp; for(i=0;i<length-1;i++) for(j=i+1;j<length;j++) { if(a[i]>a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } for(i=0;i<length;i++) printf("%d ",a[i]); printf("\n"); }
标签:style blog color io art for re c
原文地址:http://www.cnblogs.com/thrive/p/3866253.html