简单选择排序
#include
void SelectSort(int a[],int n)
{
int i,j,temp;
for(j=0;jfor(i=j+1;iif(a[j]{temp=a[i];a[i]=a[j];a[j]=temp;}}void main(){int i,a[10] ;printf("输入10个数:\n");for(i=0;i<10;i++)scanf("%d",&a[i]);SelectSort(a,10);for(i=0;i<10;i++)printf("%d ",a[i]);system("pause");}
for(i=j+1;iif(a[j]{temp=a[i];a[i]=a[j];a[j]=temp;}}void main(){int i,a[10] ;printf("输入10个数:\n");for(i=0;i<10;i++)scanf("%d",&a[i]);SelectSort(a,10);for(i=0;i<10;i++)printf("%d ",a[i]);system("pause");}
if(a[j]{temp=a[i];a[i]=a[j];a[j]=temp;}}void main(){int i,a[10] ;printf("输入10个数:\n");for(i=0;i<10;i++)scanf("%d",&a[i]);SelectSort(a,10);for(i=0;i<10;i++)printf("%d ",a[i]);system("pause");}
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
void main()
int i,a[10] ;
printf("输入10个数:\n");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
SelectSort(a,10);
printf("%d ",a[i]);
system("pause");