#include
#include
using namespace std;
int main()
{
srand(time(0));
int a, b;
int min = 100, posI, posJ;
cin >> a >> b;
int** matrix = new int*[a];
for (int i = 0; i < a; i++)
matrix[i] = new int[b];
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b; j++)
matrix[i][j] = rand() % min;
}
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b; j++)
cout
cout
}
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b; j++)
if (matrix[i][j] < min)
{
posI = i;
posJ = j;
min = matrix[i][j];
}
}
matrix[posI][posJ] = matrix[0][0];
matrix[0][0] = min;
cout
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b; j++)
cout
cout
}
for (int i = 0; i < a; i++)
delete[] matrix[i];
delete[] matrix;
system("pause");
return 0;
}