Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>//дан двумерный массив, определить сумму максимальных элементов каждой строки
- using namespace std;
- int main()
- {
- int n, m;
- cin >> n >> m;
- double** mas = new double*[n];
- for(int i = 0; i < n; i++)
- mas[i] = new double [m];
- double sum = 0;
- for(int i = 0; i < n; i++)
- {
- double maximum = -1000000;
- for(int j = 0; j < m; j++)
- {
- cin >> mas[i][j];
- if (mas[i][j] > maximum)
- maximum = mas[i][j];
- }
- sum += maximum;
- }
- cout << sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement