Polnochniy

Untitled

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