#include <iostream>
#include <fstream>
using namespace std;
int det(int a[3][3])
{
int W1 = (
(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])
)
-
(
(a[0][1] * a[1][0] * a[2][2]) +
(a[0][0] * a[1][2] * a[2][1]) +
(a[0][2] * a[1][1] * a[2][0])
);
return W1;
}
int det2(int b[3][3])
{
int W2 = (
(b[0][0] * b[1][1] * b[2][2]) +
(b[0][1] * b[1][2] * b[2][0]) +
(b[0][2] * b[1][0] * b[2][1])
)
-
(
(b[0][1] * b[1][0] * b[2][2]) +
(b[0][0] * b[1][2] * b[2][1]) +
(b[0][2] * b[1][1] * b[2][0])
);
return W2;
}
int det3(int c[3][3])
{
int W3 = (
(c[0][0] * c[1][1] * c[2][2]) +
(c[0][1] * c[1][2] * c[2][0]) +
(c[0][2] * c[1][0] * c[2][1])
)
-
(
(c[0][1] * c[1][0] * c[2][2]) +
(c[0][0] * c[1][2] * c[2][1]) +
(c[0][2] * c[1][1] * c[2][0])
);
return W3;
}
int main()
{
ifstream plik;
ofstream plikZapis;
plik.open("dane.txt");
plikZapis.open("wynik.txt");
int x1,x2,x3,x4,y1,y2,y3,y4;
while( !plik.eof() )
{
plik >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
}
int tab[3][3] = {x1,y1,1,
x2,y2,1,
x4,y4,1};
int tab2[3][3] = {x2,y2,1,
x3,y3,1,
x4,y4,1};
int tab3[3][3] = {x3,y3,1,
x1,y1,1,
x4,y4,1};
if(det(tab) < 0 && det2(tab2) < 0 && det3(tab3) < 0 ) plikZapis << "Punkt D znajduje sie w trojkacie.";
if(det(tab) > 0 && det2(tab2) > 0 && det3(tab3) > 0 ) plikZapis << "Punkt D znajduje sie w trojkacie.";
if(det(tab) == 0 || det2(tab2) == 0 || det3(tab3) == 0 ) plikZapis << "Punkt D znajdusie sie na jednym z odcinkow trojkata.";
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}