#include <stdio.h>
int main(int argc, const char * argv[])
{
int a[]={1,2,4,6,7,0};
int n=sizeof(a)/sizeof(int);
//1.冒泡
for (int i=0; i<n;i++) {
for (int j=0; j<n-i-1; j++) {
if (a[j]<a[j+1]) {
int co=a[j];
a[j]=a[j+1];
a[j+1]=co;
}
}
}
for (int i=0; i<n; i++)
{
printf("%d",a[i]);
}
//2.
for (int i=0; i<n;i++)
{
int k=0;
for (int j=0; j<n-i-1; j++)
{
if (a[j]<a[j+1])
{
k=j+1;
}
int su=a[k];
a[k]=a[j];
a[j]=su;
}
}
for (int i=0; i<n; i++)
{
printf("%d",a[i]);
}
//3.
int a[N],i,j,r,t;
for (i = 0; i < N; i++) {
scanf("%d", &a[i]);
}
for (i = 0; i < N-1; i++) {
r = i;
for (j = i +1; j < N; j++) {
if (a[j] <a[r]) {
r = j;
}
}
if (r != i) {
t = a[r];
a[r] = a[i];
a[i] = t;
}
}
for (i = 0; i < N; i++) {
printf("%d
", a[i]);
}
return 0;
}