#include <iostream>
#include <array>
#include <algorithm>
#include <random>
#include <iterator>
const size_t size_matrix = 5;
int main()
{
std::random_device random;
std::mt19937 generator(random());
std::uniform_real_distribution<float> dist(1.0, 100.0);
std::array<float, size_matrix> matrix[size_matrix];
for (size_t i = 0; i < size_matrix; i++)
{
std::for_each(matrix[i].begin(), matrix[i].end(), [&generator, &dist](auto& var)
{
var = dist(generator);
});
}
for (size_t i = 0; i < size_matrix; i++)
{
std::copy(matrix[i].begin(), matrix[i].end(),
std::ostream_iterator<float>(std::cout, " "));
std::cout << std::endl;
}
std::cout << "Result: " << std::endl;
for (size_t i = 0; i < size_matrix; i++)
std::cout << matrix[i][i] << std::endl;
std::system("PAUSE >> void");
return 0;
}