Hello i am a bit new in C++. i started to take C++ 4 days ago hehe and honestly i love it.
now im trying to do is a 3x3 determinant and it is giving me a small problem i tried to find this.
1 2 3
4 5 6
7 8 9
the answer is suppose to be 0 but on the C++ i made i get 42
then played around with the order and now i get 72. i don't know what it is but here is what i have so far.
// 3x3 Determinants.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
void main()
{
int a1,a2,a3,b1,b2,b3,c1,c2,c3,d; //a=column1,b=rcolumn2,c=column3,d=determinants
cout<<"a1 ";
cin>>a1;
cout<<"b1 ";
cin>>b1;
cout<<"c1 ";
cin>>c1;
cout<<"a2 ";
cin>>a2;
cout<<"b2 ";
cin>>b2;
cout<<"c2 ";
cin>>c2;
cout<<"a3 ";
cin>>a3;
cout<<"b3 ";
cin>>b3;
cout<<"c3 ";
cin>>c3;
d=((a1*b2*c3)+(a3*b3*c1)+(a3*b1*c2)) + (-c1*-b2*-a3)+(-c2*-b3*-a1)+(-c3*-b1*-a2);
cout<<"Determinant = "<<d
<<endl;
}