Поменять местами столбцы в двумерном массиве - C#
Формулировка задачи:
}
}
static void SortСolumn(int[,] columnmas)
{
for (int i = 0; i < columnmas.GetLength(0); i++)
{
for(int j=0;j<columnmas.GetLength(1);j++)
{
int buf = columnmas[i, j];
columnmas[i, j] = columnmas[i, columnmas.GetLength(1) - 1 - i];
columnmas[i, columnmas.GetLength(1) - 1 - i] = buf;
}
}
}Решение задачи: «Поменять местами столбцы в двумерном массиве»
textual
Листинг программы
static void SortСolumn(int[,] columnmas)
{
for (int i = 0; i < columnmas.GetLength(0); i++)
{
for (int j = 0; j < columnmas.GetLength(1)/2; j++)
{
int buf = columnmas[i, j];
columnmas[i, j] = columnmas[i, columnmas.GetLength(1) - 1 - j];
columnmas[i, columnmas.GetLength(1) - 1 - j] = buf;
}
}
}