int main() { QTextStream out(stdout); out << "hw2.2.3 Matrix Sorter" << endl; int **a = new int*[3]; for (int i = 0; i < 3; i++) { a[i] = new int[3]; for (int j = 0; j < 3; j++) { a[i][j] = i * 3 + j + 1; } } a[0][0] = 2; a[0][1] = 1; print(a, 3, 3); out << endl; MatrixSorter<int> sorter; sorter.sort(a, 3, 3); print(a, 3, 3); for (int i = 0; i < 3; i++) { delete[] a[i]; } delete[] a; }
int main() { int rows, cols = 0; printf("Rows:\n"); scanf("%d", &rows); printf("Cols:\n"); scanf("%d", &cols); int **array = new int*[rows]; fillMatrix(array, rows, cols); MatrixSorter *sorter = new MatrixSorter(array, rows, cols); printf("Before sort:\n"); sorter->print(); printf("Arter sort:\n"); sorter->sort(); sorter->print(); delete sorter; return 0; }