//================================================================//
//对数组a[0:8]=[3,2,6,5,9,4,7,1,8]进行冒泡排序 //
//================================================================//
int main()
{
int a[9] = { 3,2,6,5,9,4,7,1,8 };
int i,j;
for (i = 9;i>0;i--)
{
for (j = 0; j<9-i;j++)
{
if (a[j] > a[j + 1])
{
int temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
for (j=0;j<9;j++)
cout << a[j];
return 0;
}