1

The thing is I recently started looking at C# and designing this code (enter 7 numbers and order them from the least to the greatest)and got the "error CS1023" but i dont really know where the flaw is (in he code). It is supposed to be on the bold statement, but like i said. I do not comprenhend the problem in the logic

    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]);
    }
}
jeb
  • 78,592
  • 17
  • 171
  • 225
c.pacheco
  • 7
  • 1

0 Answers0