int SqInsert(SqList &L,ElemType e){
int i,j;
ElemType x;
int len=L.length;
L.elem[len+1]=e;
for(i=1;i<len;i++){
for(j=i+1;j<len+1;j++){
if(L.elem[i]>L.elem[j]){
x=L.elem[i];
L.elem[i]=L.elem[j];
L.elem[j]=x;
}
}
}
return 1;
}
哪個大神可以給小弟找一下錯誤唉
uj5u.com熱心網友回復:
陣列長度是1,取值是0、長度是2,取值是0,1。明白了么,長度是n,下標0-n-1的。你的下標錯了,自己改下。轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/15803.html
標籤:基礎類
上一篇:GDI+自繪怎么實作多次繪圖
下一篇:C++ debug 程式報錯
