#include <iostream>
#include <array>
#include <time.h>
using namespace std;
int arraySum(array<int,10> a)
{
int initial_sum = 0;
for (auto const& a1 : a)
{
initial_sum += a1;
}
return initial_sum;
}
int main()
{
srand(time(0));
setlocale(LC_ALL, "Russian");
double aver_A, aver_B, aver_C;
int count_A = 0, count_B = 0, count_C = 0;
array<int, 10> A = {1,5,8,2,4,10,15,4,3,1}, B, C;
int max = A[1];
for (size_t i = 1; i < sizeof(A) / sizeof(A[10]); i++)
{
if (max < A[i]) max = A[i];
}
int n = sizeof(A) / sizeof(A[0]);
for (size_t i = 0; i < sizeof(A) / sizeof(A[10]); i++)
{
B[i] = rand() % 6 - 2;
}
for (size_t i = 0; i < sizeof(B) / sizeof(B[10]); i++)
{
if (B[i] > 0)
C[i] = max;
else
C[i] = B[i];
}
aver_A = arraySum(A) / 10;
aver_B = arraySum(B) / 10;
aver_C = arraySum(C) / 10;
for (auto const& a : A)
{
cout << " " << a <<", ";
}
cout << "\n";
for (auto const& b : B)
{
cout<< " " << b << ", ";
}
cout << "\n";
for (auto const& c : C)
{
cout << c << ", ";
}
for (auto const& a : A)
{
if (a > aver_A)
count_A++;
}
cout << "\n";
for (auto const& b : B)
{
if (b > aver_B)
count_B++;
}
cout << "\n";
for (auto const& c : C)
{
if (c > aver_C)
count_C++;
}
cout << "Среднее в A: " << aver_A << ". " << "A массив: " << count_A << "\n";
cout << "Среднее в B: " << aver_B << ". " << "B массив: " << count_B << "\n";
cout << "Среднее в C: " << aver_C << ". " << "C массив: " << count_C << "\n";
return 1;
}