Advertisement
Kolyach

Файлы 56

Dec 10th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     setlocale(LC_ALL, "russian");
  9.     float i, j;
  10.     cout << "Введите кол-во строк и столбцов в массиве: ";
  11.     cin >> i >> j;
  12.     float **arr = new float*[i];
  13.     for (int n = 0; n < i; n++)
  14.         arr[n] = new float[j];
  15.  
  16.     for (int n = 0; n < i; n++) {
  17.         for (int z = 0; z < j; z++) {
  18.             cin >> arr[n][z];
  19.         }
  20.     }
  21.     float summ=0;
  22.     for (int n = 0; n < i; n++) {
  23.         for (int z = 0; z < j; z++) {
  24.             summ += arr[z][n];
  25.         }
  26.     }
  27.     cout << "Сумма элементов равна: " << summ << endl;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement