#include<stdio.h>
#include<stdlib.h>
int main()
{
int a[] = { 1,2,3,4,5,6,7,8,9 };
int len = sizeof(a) / sizeof(a[0]);
printf("你输入了%d个整数\n",len);
int i, j, tmp;
for (i = 0; i < len - 1; i++)//此处的len-1为循环9次a[0]-a[8]
{
for (j = 0; j < len - 1 - i; j++)//此处的len-1-i每循环一次(i)就少一排所以len-1-i
{
if (a[j] < a[j + 1])
{
tmp = a[j];
a[j] = a[j + 1];
a[j + 1] = tmp;
}
}
}
for (i = 0; i < len; i++)
{
printf("%d\n", a[i]);
}
system("pause");
return 0;
}