Polnochniy

Untitled

Feb 10th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. using namespace std;
  4. const int N = 3;
  5. const int P = 3;
  6. int main()
  7. {
  8. int a[N][P];
  9. int Minor, M00, M01, M02, M10, M11, M12, M20, M21, M22;
  10. setlocale(LC_ALL, "Rus");
  11. srand(time(NULL));
  12. cout << "Найти минор матрицы 3 на 3 " << endl;
  13. cout << "Вывод элементов" << endl;
  14. for (int i = 0; i < N; i++)
  15. {
  16. for (int j = 0; j < P; j++)
  17. {
  18. a[i][j] = rand() % 12;
  19. cout << a[i][j] << " ";
  20. }
  21. cout << endl;
  22. }
  23. for (int i = 0; i < P; i++)
  24. {
  25. for (int j = 0; j < N; j++)
  26. {
  27. M00 = a[1][1] * a[2][2] - a[2][1] * a[1][2];
  28. M10 = a[0][1] * a[2][2] - a[2][1] * a[0][2];
  29. M20 = a[0][1] * a[1][2] - a[1][1] * a[0][2];
  30. M01 = a[1][0] * a[2][2] - a[2][0] * a[1][2];
  31. M11 = a[0][0] * a[2][2] - a[2][0] * a[0][2];
  32. M21 = a[0][0] * a[1][2] - a[1][0] * a[0][2];
  33. M02 = a[1][0] * a[2][1] - a[2][0] * a[1][1];
  34. M12 = a[0][0] * a[2][1] - a[2][0] * a[0][1];
  35. M22 = a[0][0] * a[1][1] - a[1][0] * a[0][1];
  36. }
  37. }
  38. cout << "Минор равен " << endl;
  39. cout << M00 << " " << M01 << " " << M02 << endl;
  40. cout << M10 << " " << M11 << " " << M12 << endl;
  41. cout << M20 << " " << M21 << " " << M22 << endl;
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment