void task_1(float **arr, int &size)
{
int temp,index;
for(int i = 1; i < size/2; i++)
{
for(int j = 1; j < size/2; j++)
{
temp = arr[j][i];
index = j;
while ( (index > 0) && (arr[index - 1][i] > temp))
{
arr[index][i] = arr[index - 1][i];
index--;
}
arr[index][i] = temp;
}
}
}
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
using namespace std;
int main()
{
srand(unsigned(time(0)));
unsigned n = 2*(rand() % 3 + 2);
vector<vector<int>>reptiloid;
for (unsigned j = 0; j < n; j++)
{
vector<int> ter;
for (unsigned c = 0; c < n; c++)
{
ter.push_back(rand() % 100);
}
reptiloid.push_back(ter);
}
for (const auto& v : reptiloid)
{
for (const auto& b : v)
{
cout << setw(7) << b;
}
cout << endl;
}
cout << endl << endl << endl;
vector<int> barge;
for (unsigned u1 = 0; u1 < (n/2); u1++)
{
for (unsigned u2 = 0; u2 < n/2; u2++)
{
if ((u1 + u2) >= (n / 2) - 1)
{
barge.push_back(reptiloid[u1][u2]);
}
}
cout << endl;
}
sort(barge.begin(), barge.end());
auto c = barge.begin();
for (unsigned u1 = 0; u1 < n / 2; u1++)
{
for (unsigned u2 = 0; u2 < n / 2; u2++)
{
if ((u1 + u2) >= (n / 2) - 1)
{
reptiloid[u1][u2] = (*c);
c++;
}
}
cout << endl;
}
cout << "Changed:" << endl << endl;
for (const auto& v : reptiloid)
{
for (const auto& b : v)
{
cout << setw(7) << b;
}
cout << endl;
}
return 0;
}