Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

C++: #include <iostream>

struct vector3 {
    double x, y, z;
    vector3(double x, double y, double z): x(x), y(y), z(z) {}
};

vector3 cross_product(const vector3 &v1, const vector3 &v2)
{
    return vector3(v1.y*v2.z-v1.z*v2.y,v1.z*v2.x-v1.x*v2.z,v1.x*v2.y-v1.y*v2.x);
}

int main()
{
    while (true) {
        double x1, y1, x2, y2, x3, y3, xp, yp;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
        if (std::cin.eof()) break;

        vector3 p1(xp - x1, yp - y1, 0.0), p2(xp - x2, yp - y2, 0.0), p3(xp - x3, yp - y3, 0.0);
        vector3 cp1 = cross_product(p1, p2), cp2 = cross_product(p2, p3), cp3 = cross_product(p3, p1);
        if (cp1.z < 0.0 && cp2.z < 0.0 && cp3.z < 0.0) std::cout << "YES" << std::endl;
        else if (cp1.z > 0.0 && cp2.z > 0.0 && cp3.z > 0.0) std::cout << "YES" << std::endl;
        else std::cout << "NO" << std::endl;
    }
}

C++: #include<iostream>
#include<utility>
using namespace std;

int judge(pair<double, double> p1, pair<double, double> p2){
	double S = p1.first*p2.second - p2.first*p1.second;
	if (0 < S) return 1;
	if (0 > S) return -1;
	if (0 == S) return 0;
}

int main(){
	pair<double, double> A, B, C, P;

	while (cin >> A.first >> A.second >> B.first >> B.second >> C.first >> C.second >> P.first >> P.second){
		pair<double, double> AB, BC, CA, AP, BP, CP;
		AB = { B.first - A.first, B.second - A.second };
		BC = { C.first - B.first, C.second - B.second };
		CA = { A.first - C.first, A.second - C.second };
		AP = { P.first - A.first, P.second - A.second };
		BP = { P.first - B.first, P.second - B.second };
		CP = { P.first - C.first, P.second - C.second };
		
		if (judge(AP, AB) == judge(BP, BC) && judge(BP, BC) == judge(CP, CA) && judge(CP, CA) == judge(AP, AB)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;

typedef struct POINT_tag // POINT_t …… 点
{
	double x; // x 座標
	double y; // y 座標
} POINT_t;

typedef struct LINE_tag // LINE_t …… 線分、直線
{
	POINT_t a; // 始点
	POINT_t b; // 終点
} LINE_t;

typedef struct TRIANGLE_tag // TRIANGLE_t …… 三角形
{
	POINT_t a;
	POINT_t b;
	POINT_t c;
} TRIANGLE_t;

int side( POINT_t *p, LINE_t *e )
{
	POINT_t p1 = *p;
	POINT_t p2 = e->a; // 有向線分 e の始点
	POINT_t p3 = e->b; // 有向線分 e の終点

	// 有向線分 (p2,p1), (p2,p3) の外積の z 成分を求める
	const double n  = p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y);
	if      ( n > 0 ) return  1; // 左
	else if ( n < 0 ) return -1; // 右
	else              return  0; // 線上
}//side

int PointInTriangle( POINT_t *p, TRIANGLE_t *t )
{
	LINE_t ab, bc, ca;
	ab.a = t->a; ab.b = t->b;
	bc.a = t->b; bc.b = t->c;
	ca.a = t->c; ca.b = t->a;
	const int pab = side( p, &ab ); // 有向線分 ab から見た点 p の方向
	const int pbc = side( p, &bc ); // 有向線分 bc から見た点 p の方向
	const int pca = side( p, &ca ); // 有向線分 ca から見た点 p の方向

	// 三角形の内側にあれば正
	if ( (0 < pab) && (0 < pbc) && (0 < pca) )
		return 1; // 点 p が常に左側にある（時計回り）
	if ( (0 > pab) && (0 > pbc) && (0 > pca) )
		return 1; // 点 p が常に右側にある（反時計回り）

	// 三角形の線上にあれば負
	if ( (0 <= pab) && (0 <= pbc) && (0 <= pca) )
		return -1; // 点 p が常に左側にある（時計回り）
	if ( (0 >= pab) && (0 >= pbc) && (0 >= pca) )
		return -1; // 点 p が常に右側にある（反時計回り）

	// 三角形の外側にあれば 0
	return 0;
}//PointInTriangle

int main(){

	//double a,b,c,d,e,f,x,y;
	POINT_t p1,p2,p3,po;
	TRIANGLE_t tr;
		
	while(1){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> po.x >> po.y;
		tr.a = p1;
		tr.b = p2;
		tr.c = p3;
		if(PointInTriangle(&po,&tr)>0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		if(cin.eof())break;
	}
	return 0;
}

C++: 
#include<iostream>
#include <math.h>
#include<cstdio>
using namespace std;

//???????????????
struct Vertex2D{
	double x;
	double y;
};
//?????????????????????(????????¨??????)
#define Vector2D Vertex2D

//???????????¢
double distance_vertex(Vertex2D p1, Vertex2D p2) {
	return pow( ( p2.x - p1.x ) * ( p2.x - p1.x ) + ( p2.y - p1.y ) * ( p2.y - p1.y ), 0.5 );
}

//??????????????????
double cross_vector(Vector2D vl, Vector2D vr) {
	return vl.x * vr.y - vl.y * vr.x;
}

//???P??¨???(AB)????????¢
double Distance_DotAndLine(Vertex2D P, Vertex2D A, Vertex2D B )
{
	Vector2D AB,AP;

	AB.x = B.x - A.x;
	AB.y = B.y - A.y;
	AP.x = P.x - A.x;
	AP.y = P.y - A.y;

	//????????????AB???AP??????????????¶???????????????????????¢D?????¢????????????
	double D =  cross_vector( AB, AP );

	double L = distance_vertex( A, B );	//AB???????????¢

	double H = D / L;
	return H;

}


int main(){

	struct  Vertex2D point[4];
	while(	scanf("%lf %lf %lf %lf %lf %lf %lf %lf ",&point[0].x , &point[0].y,
													 &point[1].x , &point[1].y,
													 &point[2].x , &point[2].y,
													 &point[3].x , &point[3].y) != EOF){

	for(int i=0;i<=3;i++){
		double tmp =  Distance_DotAndLine(point[i%3],point[(i+1)%3],point[3]);
		if(tmp < 0){
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	double x[3],y[3],px,py;
	while(cin>>x[0]>>y[0]){
		for(int i=1;i<3;i++)cin>>x[i]>>y[i];
		cin>>px>>py;
		bool ok=true;
		for(int i=0;i<3;i++){
			bool plus=false;
			if(x[(i+1)%3]==x[(i+2)%3]){
				if(x[i]>x[(i+1)%3])plus=true;
				if(x[i]==x[(i+1)%3])ok=false;
			}
			else{
				double a,b;
				a=(x[i]+x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
				b=(y[i]+y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
				if(a>b)plus=true;
				if(a==b)ok=false;
			}
			bool pnt=false;
			if(x[(i+1)%3]==x[(i+2)%3]){
				if(px>x[(i+1)%3])pnt=true;
				if(px==x[(i+1)%3])ok=false;
			}
			else{
				double a,b;
				a=(px+x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
				b=(py+y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
				if(a>b)pnt=true;
				if(a==b)ok=false;
			}
			if(pnt!=plus)ok=false;
		}
		if(ok)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<cmath>
using namespace std;

double spase(double a,double b,double c,double d,double e,double f){
	double x,y,z;
	x=sqrt( (a-c)*(a-c)+(b-d)*(b-d) );
	y=sqrt( (c-e)*(c-e)+(d-f)*(d-f) );
	z=sqrt( (e-a)*(e-a)+(f-b)*(f-b) );
	return sqrt((x+y+z)*(y-x+z)*(x-y+z)*(x+y-z));
}

int main(){
	double a,b,c,d,e,f,p,q;
	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f,&p,&q) != EOF ){
	if( (float)spase(a,b,c,d,e,f)==(float)(spase(a,b,c,d,p,q)+spase(a,b,e,f,p,q)+spase(p,q,c,d,e,f)) ){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	}
	return 0;
}