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>
#include<cmath>
#include<algorithm>
#include<utility>
using namespace std;
double x,y;
double cross(double a,double b,double c,double d)
{
	return a*d-b*c;
}
bool C(double a,double b,double c,double d,double e,double f)
{
	if(cross(a,b,c,d)<0)
	{
		swap(a,c);
		swap(b,d);
	}
	pair<double,int>p[3];
	p[0]=make_pair(atan2(d-b,c-a),2);
	p[1]=make_pair(atan2(f-b,e-a),1);
	p[2]=make_pair(atan2(y-b,x-a),0);
	sort(p,p+3);
	return p[1].second==0;
}
int main()
{
	double a,b,c,d,e,f;
	for(;cin>>a>>b>>c>>d>>e>>f>>x>>y;)
	{
		cout<<(C(a,b,c,d,e,f)&&C(c,d,e,f,a,b)&&C(e,f,a,b,c,d)?"YES":"NO")<<endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <stdio.h>
 
using namespace std;
 
//-------------------------------------------------------------------------
// geometric library
 
namespace geometry {
 
#define EPS 1E-10 ///< 0とみなすサイズ。適当

struct point {
    double x;
    double y;

	point& operator += (const point& rhs) { x += rhs.x; y += rhs.y; return *this; }
	point& operator -= (const point& rhs) { x -= rhs.x; y -= rhs.y; return *this; }
	point& operator /= (double factor) { x /= factor; y /= factor; return *this; }
	point& operator *= (double factor) { x *= factor; y *= factor; return *this; }
	bool operator == (const point& rhs) const { return (std::abs(x - rhs.x) < EPS) && (std::abs(y - rhs.y) < EPS); }
	bool operator != (const point& rhs) const { return !(*this == rhs); }
};

typedef point vector;
 
struct circle {
    point center;
    double radius;
};
 
struct line { // ax + by + c = 0
    double a;
    double b;
    double c;
};

enum rotate_dir {
	rotate_None = 0,
	rotate_CW   = 1,
	rotate_CCW  = -1
};

point operator + (const point& p1, const point& p2)
{
	point p(p1);
	p += p2;
	return p;
}

point operator / (const point& p1, double factor)
{
	point p(p1);
	p /= factor;
	return p;
}
 
point operator - (const point& p1, const point& p2)
{
	point p(p1);
	p -= p2;
	return p;
}

std::istream& operator >> (std::istream& is, point& p)
{
    is >> p.x >> p.y;
    return is;
}

///! 2点の距離
double get_distance(const point& p1, const point& p2)
{
    return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}
 
///! 2直線の交点
bool get_crosspoint(const line& l1, const line& l2, point *result)
{
    double denominator = l1.a * l2.b - l1.b * l2.a;
    if (denominator == 0) {
        return false;
    }
    result->x = (l1.b * l2.c - l2.b * l1.c) / denominator;
    result->y = (l2.a * l1.c - l1.a * l2.c) / denominator;
    return true;
}
 
///! 2点の垂直2等分線
bool get_bisector(const point& p1, const point& p2, line *result)
{
    if (p1 == p2) {
        return false;
    }
    result->a = 2 * (p1.x - p2.x);
    result->b = 2 * (p1.y - p2.y);
    result->c = -(p1.y - p2.y) * (p1.y + p2.y) - (p1.x - p2.x) * (p1.x + p2.x);
    return true;
}
 
///! 外接円を求める
bool get_circum_circle(const point& p1, const point& p2, const point& p3, circle *result)
{
    double a = get_distance(p1, p2);
    double b = get_distance(p2, p3);
    double c = get_distance(p3, p1);
 
    // 半径の公式
    result->radius = a * b * c / sqrt((a + b + c) * (-a + b + c) * (a - b + c) * (a + b - c));
 
    line line_p1p2;
    line line_p2p3;
 
    // 頂点の垂直2等分線の交点が外心
    return get_bisector(p1, p2, &line_p1p2) &&
           get_bisector(p2, p3, &line_p2p3) &&
           get_crosspoint(line_p1p2, line_p2p3, &result->center);
}

double cross_product(const point& p1, const point& p2)
{
	return p1.x * p2.y - p2.x * p1.y;
}

///! p1-p2-p3が左右どちらの方向に折れているかを判定
rotate_dir direction(const point& p1, const point& p2, const point& p3)
{
	vector p1_p3 = p1 - p3;
	vector p2_p3 = p2 - p3;
	double cross = cross_product(p1_p3, p2_p3);

	if (std::abs(cross) < EPS) {
		return rotate_None;
	} else if (cross > 0) {
		return rotate_CW;
	} else {
		return rotate_CCW;
	}
}
 
// (p1s, p1e)と(p2s, p2e)の線分交差判定.EPS以下で接している場合はtrue、重なっている場合はfalse
bool intersect(const point& p1s, const point& p1e, const point& p2s, const point& p2e)
{
	assert(p1s != p1e && p2s != p2e);
	return 
		(direction(p1s, p1e, p2s) != direction(p1s, p1e, p2e)) &&
		(direction(p2s, p2e, p1s) != direction(p2s, p2e, p1e));
}

// targetが三角形p1,p2,p3の内部にあるかどうか
bool is_inside_triangle(const point& p1, const point& p2, const point& p3, const point& target)
{
	point center_of_gravity = (p1 + p2 + p3) / 3; // 重心

	if (center_of_gravity == target) return true;

	// 重心とtargetを結んだ線分が三角形の辺と交叉するなら、点は三角形の外部にある
	bool intersect_any =
		intersect(p1, p2, center_of_gravity, target) ||
		intersect(p2, p3, center_of_gravity, target) ||
		intersect(p3, p1, center_of_gravity, target);

	return !intersect_any;
}

} // namespace geometry
 
//-------------------------------------------------------------------------
// solution
 
using namespace geometry;

int main(void)
{
	point p1,p2,p3,target;

	while (cin >> p1 >> p2 >> p3 >> target) {
		cout << (is_inside_triangle(p1, p2, p3, target) ? "YES\n" : "NO\n");
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    double x[3], y[3], xp, yp;
    double ax, ay, bx, by;
    while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp) {
        int posi = 0, nega = 0;
        for (int i=0; i<3; ++i) {
            ax = x[(i+1)%3] - x[i];
            ay = y[(i+1)%3] - y[i];
            bx = xp - x[i];
            by = yp - y[i];
            if (ax * by - ay * bx > 0) {
                posi ++;
            } else {
                nega ++;
            }
        }
        if ( ! posi || ! nega) {
            cout << "YES" << "\n";
        } else {
            cout << "NO" << "\n";
        }
    }
    return 0;
}

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

double ts(double x1,double x2,double x3,double y1,double y2,double y3){
	return fabs(((x1*y2+x2*y3+x3*y1)-(x3*y2+x2*y1+x1*y3))/2);
}


int main(){
	
	double x1,x2,x3;
	double	y1,y2,y3;
	double xp,yp;
	
	while(cin>>x1){
		cin>>y1>>x2>>y2>>x3>>y3>>xp>>yp;
		
		double S,s1,s2,s3;
		S=ts(x1,x2,x3,y1,y2,y3);
		s1=ts(xp,x2,x3,yp,y2,y3);
		s2=ts(x1,xp,x3,y1,yp,y3);
		s3=ts(x1,x2,xp,y1,y2,yp);
		if(s1+s2+s3==S)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
	}
	
}