Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- using namespace std;
- const int N = 3;
- const int P = 3;
- int main()
- {
- int a[N][P];
- int Minor, M00, M01, M02, M10, M11, M12, M20, M21, M22;
- setlocale(LC_ALL, "Rus");
- srand(time(NULL));
- cout << "Найти минор матрицы 3 на 3 " << endl;
- cout << "Вывод элементов" << endl;
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < P; j++)
- {
- a[i][j] = rand() % 12;
- cout << a[i][j] << " ";
- }
- cout << endl;
- }
- for (int i = 0; i < P; i++)
- {
- for (int j = 0; j < N; j++)
- {
- M00 = a[1][1] * a[2][2] - a[2][1] * a[1][2];
- M10 = a[0][1] * a[2][2] - a[2][1] * a[0][2];
- M20 = a[0][1] * a[1][2] - a[1][1] * a[0][2];
- M01 = a[1][0] * a[2][2] - a[2][0] * a[1][2];
- M11 = a[0][0] * a[2][2] - a[2][0] * a[0][2];
- M21 = a[0][0] * a[1][2] - a[1][0] * a[0][2];
- M02 = a[1][0] * a[2][1] - a[2][0] * a[1][1];
- M12 = a[0][0] * a[2][1] - a[2][0] * a[0][1];
- M22 = a[0][0] * a[1][1] - a[1][0] * a[0][1];
- }
- }
- cout << "Минор равен " << endl;
- cout << M00 << " " << M01 << " " << M02 << endl;
- cout << M10 << " " << M11 << " " << M12 << endl;
- cout << M20 << " " << M21 << " " << M22 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment