Advertisement
Artem771577

Lab3ex4

Oct 15th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. ////////////////////////////////////////////////
  2. double max = LONG_MIN;
  3. int index1 = 0, index2 = 0;
  4. for (int i = 1; i < Rows + 1; i++)
  5. {
  6. for (int j = 1; j < Cols + 1; j++)
  7. {
  8. if (matrix2[i][j] < 0)
  9. {
  10. if (matrix2[i][j] >= max)
  11. {
  12. max = matrix2[i][j];
  13. index1 = i;
  14. index2 = j;
  15. }
  16. }
  17. }
  18. }
  19. if (index1 == 0)
  20. cout << "Отрицательных элементов нет";
  21. else
  22. {
  23. cout << "Максимальный отрицательный элемент сглаженной матрицы : " << max << endl;
  24. cout << "А координаты этого элемента : " << endl << "Строчка : " << index1 << endl << "Столбец :" << index2 << endl;;
  25. }
  26.  
  27. system("pause");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement