三星程序部招聘的考卷,大家做做能得几分(填空3)
3)一下程序是用冒泡排序发对数组按升序进行排序,请将程序补充完整#include<iostream.h>
void bubble(int[],int);
void main()
{
int array[]={55,2,6,4,32,12,9,73,26,37};
int len=_______________________________;
for(int i=0; i<len; i++)
cout<<array[i]<<",";
cout<<endl;
bubble(array,len);
}
void bubble(int a[],int size)
}
int i,temp;
for(int pass=1;__________; pass++)
{for(i=0;____________; 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;
}