#include <iostream>
using namespace std;
int main()
{
setlocale(0, "Rus");
const int N = 5;
int sum = 0;
int i, j;
double average;
int count = 0;
int matrix[N][N] = { 11, 23, 45, 67, 78,
33, 67, 12, 89, 70,
45, 44, 14, 59, 60,
1, 34, 67, 78, 90,
46, 78, 89, 12, 11 };
for ( i = 0; i < N; i++)
for ( j = 0; j < N; j++)
sum += matrix[i][j];
cout << "Сумма всех элементов равна " << sum << endl;
average = (double)sum / (N*N);
cout << "Среднее значение в матрице равно " << average << endl;
for ( i = 0; i < N; i++)
for ( j = 0; j < N; j++)
if(matrix[i][j] > average)
{
cout << "Первый элемент больший среднего арифмитеческого " << count << endl;
system("Pause");
return 0;
}
return 0;
}
Следующий вариант
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;
int main()
{
setlocale(0, "rus");
const int N = 10;
int matrix[N][N];
srand((unsigned) time(0));
int i, j;
int sum = 0;
int average;
int index_i, index_j;
for ( i = 0; i < N; i++)
for ( j = 0; j < N; j++)
matrix[i][j] = rand() % 100;
for ( i = 0; i < N; i++)
for ( j = 0; j < N; j++)
{
if( j % 10 == 0)
cout << endl;
cout << setw(3) << matrix[i][j];
}
cout << endl << endl;
for ( i = 0; i < N; i++)
for ( j = 0; j < N; j++)
sum += matrix[i][j];
average = sum / (N*N);
cout << "Среднее значение равно " << average << endl;
for ( i = 0; i < N; i++)
{
for ( j = 0; j < N; j++)
if( matrix[i][j] > average)
{
index_i = i;
index_j = j;
break;
}
if(matrix[i][j] > average)
break;
}
cout << endl << endl;
cout << "Первый элемент который больше среднего значения " << endl;
cout << "расположен в строке " << index_i << " и столбце " << index_j << endl;
system("Pause");
}