Advertisement
Soverein

Untitled

Dec 2nd, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include<stdlib.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. const int n=5, m=5 ;
  9. cout << endl;
  10. int** matrix = new int* [n];
  11. for (int i = 0; i < n; i++)
  12. matrix[i] = new int[m];
  13. int *sumArray[n] = {};
  14. int minSum = NULL;
  15. srand(time(NULL));
  16.  
  17. for (int i = 0; i < n; i++, cout << "\t"<< endl)
  18. {
  19. for (int j = 0; j < m; j++,cout << "\t")
  20.  
  21. {
  22. matrix[i][j] = rand () % 21 - 10;
  23. cout << matrix[i][j] ;
  24. sumArray[i] += matrix[i][j];
  25.  
  26. }
  27. }
  28. for (int i = 0; i < n; ++i)
  29. {
  30. cout << endl << "Summ of the " << i + 1 << " row: " << sumArray[i] << endl;
  31. if (sumArray[i] < minSum)
  32. {
  33. minSum = sumArray[i];
  34. }
  35. }
  36. cout << endl << "Min sum: " << minSum << endl;
  37.  
  38. system("PAUSE");
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement