Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <random>
- #include<iomanip>
- using namespace std;
- void main()
- {
- setlocale(LC_ALL, "Russian");
- srand(time(0));
- int array[8][5];
- int max = INT_MIN;
- int min = INT_MAX;
- int max_s = 0;
- int max_s_a = INT_MIN;
- int number_s = 0;
- for (int i = 0; i < 8; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- array[i][j] = rand() % 20 - 10;
- cout << setw(3) << array[i][j] << " ";
- if (max < array[i][j]) max = array[i][j];
- if (min > array[i][j]) min = array[i][j];
- max_s = array[i][j];
- }
- if (max_s_a < max_s)
- {
- max_s_a = max_s;
- number_s = i;
- }
- max_s = 0;
- cout << endl;
- }
- cout<<"Максимальное число: " << max << endl;
- cout << "Минимальное число: " << min << endl;
- cout << "Строка " << number_s+1 << ": ";
- for (int i = 0; i < 5; i++)
- {
- cout << array[number_s][i] << " ";
- }
- cout << endl;
- int column;
- int line;
- cout << "Введите количество столбов: ";
- cin >> column;
- cout << "Введите количество строк: ";
- cin >> line;
- int** array_din = new int*[column];
- for (int i = 0; i < column; i++)
- array_din[i] = new int [line];
- max = INT_MIN;
- min = INT_MAX;
- max_s = 0;
- max_s_a = INT_MIN;
- number_s = 0;
- for (int i = 0; i < column; i++)
- {
- for (int j = 0; j < line; j++)
- {
- array_din[i][j] = rand() % 20 - 10;
- cout << setw(3) << array_din[i][j] << " ";
- if (max < array_din[i][j]) max = array_din[i][j];
- if (min > array_din[i][j]) min = array_din[i][j];
- max_s = array_din[i][j];
- }
- if (max_s_a < max_s)
- {
- max_s_a = max_s;
- number_s = i;
- }
- max_s = 0;
- cout << endl;
- }
- cout << "Максимальное число: " << max << endl;
- cout << "Минимальное число: " << min << endl;
- cout << "Максимальная строка " << number_s + 1 << ": ";
- for (int i = 0; i < line; i++)
- {
- cout << array_din[number_s][i] << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement