There are two DataGridView . It is necessary to make it so that if there is a row in the first matrix, which is all ascending, then it should be copied into the second matrix. I tried to do it like this if (matA[i, j] < matA[i, j+1]) . If executed, it is written to the array. But the fact is that the last column is discarded. So please help with this.
Here is the code that I bring to the array, and not to the matrix for verification. I set columns and rows using numericUpDown.
rivate void button1_Click(object sender, EventArgs e) { int n = matrA.RowCount; int m = matrA.ColumnCount; int[,] matA = new int[n, m]; int[] mas = new int[m]; int i, j; bool b = false; for (i = 0; i < n; i++) for (j = 0; j < m; j++) matA[i, j] = Convert.ToInt32(matrA[j, i].Value); for (j = 0; j < matrB.ColumnCount; j++) matrB[j, 0].Value = j + 1; i = 1; while (i < n) { for (j = 0; j < m - 1; j++) { if (matA[i, j] < matA[i, j + 1]) { mas[j] = matA[i, j]; int c1 = mas.Length; if (c1 == m) { b = true; } } } i++; } if (b == true) { for (j = 0; j < m; j++) { textBox1.AppendText(mas[j] + "\n"); } } }