#include
#include
#include
#include
#include
const size_t
N = 5,
M = 10;
int main()
{
std::random_device rnd;
std::default_random_engine generator(rnd());
std::uniform_int_distribution dist(-10, 10);
std::array arr[N];
std::for_each(arr, arr + N, [&dist, &generator](auto& var)
{
std::for_each(var.begin(), var.end(), [&dist, &generator](auto& var1)
{
var1 = dist(generator);
});
});
std::for_each(arr, arr + N, [](auto& var)
{
copy(var.begin(), var.end(),
std::ostream_iterator(std::cout, " "));
std::cout
});
std::cout
size_t count = 0;
std::for_each(arr, arr + N, [&count](auto& var)
{
std::cout << count++ << " | " << std::count_if(var.begin(), var.end(), [](const auto& var) { return var > 0; })
});
std::system("PAUSE >> void");
return 0;
}