for int bool colSorted true for int if colSorted false isAllSorted fal

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
for (int i = 0; i < n; i++) {
bool colSorted = true;
for (int j = 1; j < n; j++) {
if ((*B)[j][i] < (*B)[j - 1][i]) {
colSorted = false;
isAllSorted = false;
break;
}
}
bool t = true;
while (t) {
t = false;
for (int k = 0; k < n - 1; k++) {
if ((*B)[k][i] > (*B)[k + 1][i]) {
float tmp = (*B)[k + 1][i];
(*B)[k + 1][i] = (*B)[k][i];
(*B)[k][i] = tmp;
t = true;
}
}
}
}