注意:此页面搜索的是所有试题
[改错题,10分]
2题目:用起泡法对10个整数从小到大排序。

程序中共有 条错误语句。

void sort(int x,int n)

{

int i,j,k,t;

for(i=0;i<>< p=""> i<n;i++)



for(j=0;j<> <n-i;j++)

if(x[j]>x[j+1])

{ t=x[j];x[j]=x[j+1];x[j+1]=t;}

}

main()

{

int i,n,a[100];

cout<<"please input the length of the array:";

cin>>n;

for(i=0; i<=n-1;i++) <><>< p="">

cin>>a[i];

sort(a,n);

cout<<"output the sorted array:";

for(i=0;i<=n-1;i++)

cout<<a[i]<<" ";

}

参考答案