Determinant v C++
Jednoduchý program v C++ pro vypočtení determinantu z matice (3×3).
#include <iostream>
using namespace std;
int main()
{
int m=4, n=4, d1=0, d2=0, det;
float mat[4][4];
cout << "\t\t\t" << "Vitej v programu DETERMINANT\n"<< endl;
cout << "Zadejte cisla pro vypocteni determinantu! - Matice 3x3" << endl;
for (int i=1;i<m;i++)
{
for (int j=1;j<n;j++)
{
cout<<"Zadavate " << j << ". cislo do " << i <<". radku matice: " ; cin>> mat [i][j];
}
}
det = (d1=((mat [1][1]*mat [2][2]*mat [3][3])+(mat [2][1]*mat [3][2]*mat [1][3])+(mat [3][1]*mat [1][2]*mat [2][3])))
-(d2=((mat [1][3]*mat [2][2]*mat [3][1])+(mat [2][3]*mat [3][2]*mat [1][1])+(mat [3][3]*mat [1][2]*mat [2][1])));
cout << "Determinant: " << det <<endl;
return 0;
}



