Advertisement
AlexandrTalchuk

5.1.11

Dec 29th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include "pch.h"
  2. #include<iostream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8.     setlocale(LC_ALL, "RUS");
  9.     int n, m, j, i, **arr, sum=0, sredn=0,k;
  10.     cout << "Введите количество строк" << endl;
  11.     cin >> n;
  12.     cout << "Введите количество столбцов" << endl;
  13.     cin >> m;
  14.     arr = new int *[n];
  15.     for (i = 0; i < n; i++)
  16.         arr[i] = new int[m];
  17.     for (i = 0; i < n; i++) {
  18.         for (j = 0; j < m; j++)
  19.         {
  20.             cout << "a[" << i + 1 << "][" << j + 1 << "]=";
  21.             cin >> arr[i][j];
  22.  
  23.         }
  24.     }
  25.     cout << "Введите значение числа К" << endl;
  26.     cin >> k;
  27.     for (int i = 0; i < n; i++) {
  28.  
  29.         for (int j = 0; j < m; j++) {
  30.             sum += arr[i][j];
  31.         }
  32.         sredn = sum / m;
  33.         if (k > sredn) cout << "Среднее арифметическое  " << i + 1 << " строки =" << sredn << endl;
  34.         else cout << "Среднее арифметическое > числа К" << endl;
  35.  
  36.  
  37.     }
  38.     for (i = 0; i < n; i++)
  39.         delete[]arr[i];
  40.     delete[]arr;
  41.  
  42.     system("pause");
  43.     return 0;
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement