**New course!**Every coder should learn

**Generative AI!**

0

# 2d array ascending order c++

I want to check that my 2d array is sorted in ascending order I have written some lines but as it seems it is little bit buggy for (e=0;e<3;e++) { for (j=0;j<3;j++) { for (r = e ; r < 3; r++) { for (c = j; c < 3; c++) { if (x[e][j] > x[r][c]) { flag = 0; break; } else { flag = 1; } } if (flag == 0) { break; } } m++; if (flag == 0) { break; } } if (flag == 0) { break; } m++; }

1 Answer

+ 1

Please use an array<array<T, x>, y>.
And in which whay should it be sorted?