搜题
问题   更新时间2023/4/3 12:59:00

[改错题,10分]
2题目:用起泡法对10个整数从小到大排序。

程序中共有 条错误语句。

void sort(int x,int n)

{

int i,j,k,t;

for(i=0;i<>< p=""> i


for(j=0;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<
}

王老师:19139051760(拨打)