c#中应用一个冒泡排序法,总是提示Index was out of range.Must be non-negative and less than the size程序:IList img_S = new List();IList Tem = new List();for (int i = 0; i < c; i++){for (int j = 0; j < c - i-1; j++){if (img_S[j].Similar
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/20 14:39:53
c#中应用一个冒泡排序法,总是提示Index was out of range.Must be non-negative and less than the size程序:IList img_S = new List();IList Tem = new List();for (int i = 0; i < c; i++){for (int j = 0; j < c - i-1; j++){if (img_S[j].Similar
c#中应用一个冒泡排序法,总是提示Index was out of range.Must be non-negative and less than the size
程序:
IList img_S = new List();
IList Tem = new List();
for (int i = 0; i < c; i++)
{
for (int j = 0; j < c - i-1; j++)
{
if (img_S[j].Similarity > img_S[j + 1].Similarity)
{
Tem[0] = img_S[j];
img_S[j] = img_S[j + 1];
img_S[j + 1] = Tem[0];
}
}
}
c是 img_S的总个数,Tem是我建立的中间数列.出现的错误提示指示在第一个 Tem[0] 处
c#中应用一个冒泡排序法,总是提示Index was out of range.Must be non-negative and less than the size程序:IList img_S = new List();IList Tem = new List();for (int i = 0; i < c; i++){for (int j = 0; j < c - i-1; j++){if (img_S[j].Similar
新建一个链表之后,它里面都是空的啊,你有调用它的成员方法比如add之类的添加元素吗?
可能Tem里一个元素都没有,Tem[0]当然会超限啊