int a[] = { 23,1,55,7,4,2 };
int n = 6, i, j, temp;
for ( i = 1; i < 6; i++) //趟数
{
for ( j = 0; j <n-i; j++) //每趟的顺序比较
if (a[j] > a[j + 1])
{ temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
for ( i = 0; i < 6; i++)
{
printf("%5d", a[i]);
标签:temp,23,int,55,冒泡排序,++
From: https://www.cnblogs.com/mtydd/p/16745367.html