Как сделать сортировку выбором в двумерном массиве? C++
Отсортированный массив:

Как написать сортировку выбором?
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
void ArrayInputRandom(int** arr, int rows, int colums);
void ArrayInput(int** arr, int rows, int colums);
void ArrayOutput(int** arr, int rows, int colums);
int bubleSort(int size, int** arr);
int choosenSort(int size, int** arr);
int menuItem();
int main()
{
setlocale(LC_ALL, "Russian");
int optionSort;
const int rows = 10;
const int colums = 10;
int** mas = new int* [rows];
for (int i = 0; i < rows; i++)
mas[i] = new int[colums];
int variant = menuItem();
if (variant == 1)
{
cout << "Массив:" << endl;
ArrayInputRandom(mas, rows, colums);
ArrayOutput(mas, rows, colums);
cout << "1.Пузырьком <-\n"
<< "2.Выбором <-\n"
<< "3.Выход ->\n"
<< ">>> ";
cin >> optionSort;
switch (optionSort)
{
case 1:
**mas = bubleSort(rows, mas);
ArrayOutput(mas, rows, colums);
break;
case 2:
choosenSort(rows, mas);
ArrayOutput(mas, rows, colums);
break;
case 3:
cout << "-Выход-" << endl;
exit(EXIT_SUCCESS);
break;
default:
cerr << "!неверный вариант!" << endl;
exit(EXIT_FAILURE);
}
}
else if (variant == 2)
{
cout << "Массив:" << endl;
ArrayInput(mas, rows, colums);
ArrayOutput(mas, rows, colums);
cout << "1.Пузырьком\n"
<< "2.Выбором\n"
<< "3.Выход\n"
<< ">>> ";
cin >> optionSort;
switch (optionSort)
{
case 1:
**mas = bubleSort(rows, mas);
ArrayOutput(mas, rows, colums);
break;
case 2:
**mas = choosenSort(rows, mas);
ArrayOutput(mas, rows, colums);
break;
case 3:
cout << "-Выход-" << endl;
exit(EXIT_SUCCESS);
break;
default:
cerr << "!неверный вариант!" << endl;
exit(EXIT_FAILURE);
}
}
else cout << "Неверное значение, программа завершина!";
return 0;
}
// выбором
int choosenSort(int size, int** arr) {
cout << endl;
int min;
int test = 0;
int point = 1;
for (int j = 0; j < size; ++j)
{
for (int i = size - j - 1; i >= 0; --i)
{
for (int col = 0; col < size - 1; ++col)
for (int row = size - col - 1; row >= 0; --row)
{
if (row > 0)
{
}
}
return **arr;
}
}
}
int bubleSort(int size, int** arr) {
cout << endl;
int test = 0;
int point = 1;
for (int j = 0 ; j < size; ++j)
{
for (int i = size - j - 1; i >= 0; --i)
{
for (int col = 0; col < size - 1; ++col)
for (int row = size - col - 1; row >= 0; --row)
{
if (row > 0)
{
if (arr[row][col] > arr[row - 1][col])
swap(arr[row][col], arr[row - 1][col]);
}
else
{
if (arr[row][col] > arr[size - 2 - col][col+1])
swap(arr[row][col], arr[size - 2 - col][col + 1]);
}
}
}
}
/*
for (int i = 0; i < size - 1; i++)
{
for (int j = 0; j < size-1; j++)
{
if (arr[j][test] < arr[j + 1][test])
swap(arr[j][test], arr[j + 1][test]);
}
test--;
}
*/
return **arr;
}
void ArrayInputRandom(int** arr, int rows, int colums)
{
srand(time(NULL));
for (int i = 0; i < rows; i++)
for (int j = 0; j < colums; j++)
arr[i][j] = rand() % 101;
}
void ArrayInput(int** arr, int rows, int colums)
{
for (int i = 0; i < rows; i++)
for (int j = 0; j < colums; j++)
{
cout << "Enter:";
cin >> arr[i][j];
cout << "\n";
}
}
void ArrayOutput(int** arr, int rows, int colums)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < colums; j++)
cout << "\t" << arr[i][j];
cout << "\n";
}
}
int menuItem()
{
int variant;
cout << "Выберите вариант\n" << endl;
cout << "1. Рандом\n"
<< "2. В ручную\n"
<< ">>> ";
cin >> variant;
return variant;
}