问题是我最近开始查看C#并设计此代码(输入7个数字并从最小到最大排序)并得到“错误CS1023”但我真的不知道缺陷在哪里(在他的代码中) )。 它应该是大胆的声明,但就像我说的那样。我没有理解逻辑中的问题
int[] sales = new int[7];
for (int count = 0; count < sales.Length; count = count +1)
{
sales[count] = SnapsEngine.ReadInteger("enter a value");
}
for (int count4 = 0; count4 < sales.Length - 1; count4 = count4 + 1)
*bool test = false;*
for (int i = 0; i < sales.Length - 1- count4;i = i +1)
{
if (sales[i+1]<sales[i])
{
int temp = sales[i];
sales[i] = sales[i + 1];
sales[i + 1] = temp;
test = true;
}
if (!test)
{
break;
}
}
for(int count2 = 0;count2 < sales.Length; count2 = count2 + 1)
{
SnapsEngine.AddLineToTextDisplay("sales " + (count2 + 1) + ": " + sales[count2]);
}
}