Advertisement
Guest User

8

a guest
Apr 25th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3.  
  4. using namespace std;
  5.  
  6. void main()
  7. {
  8. srand(time(NULL));
  9. const int N = 5, M = 4;
  10. int arr[N][N], num[M];
  11.  
  12. for (int i = 0; i < N; ++i)
  13. {
  14. for (int j = 0; j < M; ++j)
  15. {
  16. arr[i][j] = rand() % 21 - 3;
  17. cout << arr[i][j] << " ";
  18. }
  19. cout << endl;
  20. }
  21. cout << endl;
  22. for (int i = 0; i < N; ++i)
  23. {
  24. for (int j = 0; j < M; ++j)
  25. {
  26. if (arr[i][j] < 0)
  27. {
  28. num[j] = j;
  29. cout << "Stolb minus = " << j << endl;
  30. }
  31. }
  32. }
  33.  
  34. for (int j = 0; j < M; ++j)
  35. {
  36. if (num[j] >= 0)
  37. cout << num[j] << " ";
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement