Поменять местами столбцы в двумерном массиве - 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;
- }
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д