var data = read();
switch (selector)
{
case 1://accending
data = data.OrderBy(inner => inner[2]).ToArray();
drawChart();
for (int i = 0; i < data[0].Length; i++)
{
for (int j = 0; j < data.Length; j++)
{
if (j != 0)
{
Console.Write(" ");
}
Console.Write(data[j][i] + " ");
}
Console.WriteLine();
}
complete = true;
break;
case 2://decending
complete = true;
break;
default:
Console.WriteLine("Not an option please enter a number between 1 and 2");
break;
}
I have a staggered array called data which is being printed here, I need to be able to sort the arrays depending on a users input (case1 and 2)
say the data looks like this
jaggedarray[0] = new int[5] { 99, 999, 49, 79, 59 };
jaggedarray[1] = new int[3] { 199, 1999, 149 };
jaggedarray[2] = new int[2] { 999, 500 };
How can I sort it so the it sorts the 2nd column from highest to lowest then prints out the whole array?