#include<iostream.h>
void bubble(int [],int);
void main()
{
int array[]={55,2,6,4,32,12,9,37,26,73};
int len=sizeof(array)/sizeof(int);
for(int i=0;i<len;i++)
cout << array[i]<<",";
cout<<endl<<endl;
bubble(array,len);
}
void bubble(int a[],int size)
{
int i,temp;
for (int pass=1;pass<size;pass++)
{
for (i=0;i<size-pass;i++)
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
for (i=0;i<size;i++)
cout<<a[i]<<",";
cout<< endl;
}
}
就是这个代码