Can I control only the row in a 2d array? I am trying to use flat sorting in a 2d array, where I should sort the array descendingly according to one particular column
For instance,
You can,element[i][j] is a lement of Matrix i*j,i-rows,j-columns.
If you want to sort only columns than j is fixed and you only iterate i with some loop.
Thanks for answering
I did something to sort according to column number five but it doesn't work
May you please tell me what's wrong?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
{
flag = false;
for (int c = 0; c < count-1; c++)
if (s[c+1][5] > s[c][5])
{
for (int j = 0; j<6;j++)
{
t[c+1][j] = s[c][j];
s[c][j] = s[c+1][j];
s[c+1][j] = t[c][j];
}
flag = true;
}
} while (flag);