Advertisement
alexdmin

9.2

May 15th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include <vector>
  2. #include <iostream>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main(int argc, const  char* argv[]) {
  9.     srand(time(NULL));
  10.     setlocale(0, "");
  11.     int m, n;
  12.     cout << "Введите кол-во строк n:";
  13.     cin >> n;
  14.     cout << "Введите кол-во столбцов m:";
  15.     cin >> m;
  16.  
  17.     vector< vector<double> > a(n, vector<double>(m));
  18.  
  19.     cout << "Набор массива:" << endl;
  20.     for (int i_row = 0; i_row < n; i_row++) {
  21.         for (int j_column = 0; j_column < m; j_column++) {
  22.             cin >> a[i_row][j_column];
  23.         }
  24.  
  25.  
  26.     }
  27.     for (int i_row = 0; i_row < n; i_row++) {
  28.         for (int j_column = 0; j_column < m; j_column++)
  29.             cout << setw(2) << a[i_row][j_column] << "";
  30.         cout << endl;
  31.     }
  32.     cout << endl;
  33.     int maxstolb, maxstrok;
  34.     int maxMult = 0;
  35.  
  36.  
  37.  
  38.  
  39.     for (int j = 0; j < n; j++)
  40.     {
  41.         int tempM = 1;
  42.         for (int i = 0; i < m; i++)
  43.         {
  44.             tempM *= a[i][j];
  45.         }
  46.         if (maxMult < tempM) { maxstolb = j; maxMult = tempM; }
  47.     }
  48.  
  49.  
  50.     cout << "Максимальное произведение в столбике" << maxstolb + 1 << "=" << maxMult << endl;
  51.  
  52.  
  53.  
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement