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++: def side(p1, p2, p3):
    return (p3[1]-p1[1])*(p2[0]-p1[0])-(p2[1]-p1[1])*(p3[0]-p1[0])>0

while True:
    try:
        x = map(float, raw_input().split())
        p1 = x[0:2]
        p2 = x[2:4]
        p3 = x[4:6]
        p0 = x[6:]
        if (side(p1, p2, p0)==side(p2, p3, p0) and side(p2, p3, p0)==side(p3, p1, p0)):
            print "YES"
        else:
            print "NO"
    except:
        break

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

double S(double a, double b, double c, double d, double e, double f) {
	double ans;
	ans = abs((a*1000 - e*1000) * (d*1000 - f * 1000) - (b * 1000 - f * 1000) * (c * 1000 - e * 1000));
	return ans;
}

int main(){
	double x[4], y[4], s[3], SS, SSS;

	while(true){
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (cin.eof()) { break; }
		s[0] = S(x[0], y[0], x[1], y[1], x[3], y[3]);
		s[1] = S(x[0], y[0], x[2], y[2], x[3], y[3]);
		s[2] = S(x[1], y[1], x[2], y[2], x[3], y[3]);
		if(s[0] * s[1] * s[2] == 0){ 
			cout << "NO" << endl;
			continue;
		}
		SS = s[0] + s[1] + s[2];
		SSS = S(x[0], y[0], x[1], y[1], x[2], y[2]);

		if (SS == SSS) { 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 int 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;
		if(cin.eof())break;
		tr.a = p1;
		tr.b = p2;
		tr.c = p3;
		if(PointInTriangle(&po,&tr)>0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

int check(double x1, double y1, double x2, double y2, double x3, double y3){
	double ab = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	double bc = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
	double ca = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
	double s = (ab + bc + ca) * 0.5;
	double S = sqrt(s * (s - ab) * (s - bc) * (s - ca));
	return S;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
	
	double abc = check(x1, y1, x2, y2, x3, y3);
	double abp = check(x1, y1, x2, y2, xp, yp);
	double bcp = check(x2, y2, x3, y3, xp, yp);
	double cap = check(x3, y3, x1, y1, xp, yp);
	
	double var = abc - (abp + bcp + cap);
	if(var <= 0.001 && var >= -0.001){
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	}
	
	return 0;
}