Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include<stdlib.h>
- using namespace std;
- int main()
- {
- const int n=5, m=5 ;
- cout << endl;
- int** matrix = new int* [n];
- for (int i = 0; i < n; i++)
- matrix[i] = new int[m];
- int *sumArray[n] = {};
- int minSum = NULL;
- srand(time(NULL));
- for (int i = 0; i < n; i++, cout << "\t"<< endl)
- {
- for (int j = 0; j < m; j++,cout << "\t")
- {
- matrix[i][j] = rand () % 21 - 10;
- cout << matrix[i][j] ;
- sumArray[i] += matrix[i][j];
- }
- }
- for (int i = 0; i < n; ++i)
- {
- cout << endl << "Summ of the " << i + 1 << " row: " << sumArray[i] << endl;
- if (sumArray[i] < minSum)
- {
- minSum = sumArray[i];
- }
- }
- cout << endl << "Min sum: " << minSum << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement