Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main(int argc, const char* argv[]) {
- srand(time(NULL));
- setlocale(0, "");
- int m, n;
- cout << "Введите кол-во строк n:";
- cin >> n;
- cout << "Введите кол-во столбцов m:";
- cin >> m;
- vector< vector<double> > a(n, vector<double>(m));
- cout << "Набор массива:" << endl;
- for (int i_row = 0; i_row < n; i_row++) {
- for (int j_column = 0; j_column < m; j_column++) {
- cin >> a[i_row][j_column];
- }
- }
- for (int i_row = 0; i_row < n; i_row++) {
- for (int j_column = 0; j_column < m; j_column++)
- cout << setw(2) << a[i_row][j_column] << "";
- cout << endl;
- }
- cout << endl;
- int maxstolb, maxstrok;
- int maxMult = 0;
- for (int j = 0; j < n; j++)
- {
- int tempM = 1;
- for (int i = 0; i < m; i++)
- {
- tempM *= a[i][j];
- }
- if (maxMult < tempM) { maxstolb = j; maxMult = tempM; }
- }
- cout << "Максимальное произведение в столбике" << maxstolb + 1 << "=" << maxMult << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement