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 <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()
const int INF = 1e9;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */


/** 幾何ライブラリ **/
#include <complex>

#define X real()
#define Y imag()

const double EPS = 1e-11;

typedef double D;
typedef complex<D> P; // Point

struct L { // Line
	P a, b;
	L(){}
	L(P aa, P bb) : a(aa), b(bb){}
};

// 共役複素数 conj(a);

// 符号
int sig(D a, D b=0) { return a < b - EPS ? -1 : (a > b + EPS ? 1 : 0); }

// 内積
D dot(P a, P b) { return (conj(a)*b).real(); }

// 外積
D cross(P a, P b) { return (conj(a)*b).imag(); }

// 線分abに対する点cの位置
enum STATE{LEFT=1, RIGHT=-1, BACK=2, FRONT=-2, ON=0, IN=3, OUT=-3};
int ccw(P a, P b, P c)
{
	b -= a, c -= a;
	D s = sig(cross(b, c));
	if (s) return s>0 ? LEFT : RIGHT;
	if (sig(dot(b, c))<0) return BACK;
	if (sig(abs(c), abs(b))>0) return FRONT;
	return ON;
}

// 直線lに対する点pの写像
P projection(L l, P p)
{
	return l.a + (l.b-l.a)/abs(l.b-l.a) * dot(l.b-l.a, p-l.a)/abs(l.b-l.a);
}

// 直線lに対する点pの反射
P reflection(L l, P p)
{
	return p + (projection(l, p)-p)*P(2, 0);
}

// 直線abと点cの距離
D dLP(L l, P c)
{
	return abs(cross(l.b-l.a, c-l.a))/abs(l.b-l.a);
}

// 線分abと点cの距離
D dSP(L l, P c)
{
	if (sig(dot(l.b-l.a, c-l.a))<0) return abs(c-l.a);
	if (sig(dot(l.a-l.b, c-l.b))<0) return abs(c-l.b);
	return abs(cross(l.b-l.a, c-l.a))/abs(l.b-l.a);
}

// 線分と線分の交差判定
bool iSS(L s, L t)
{
	return (ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0)
			&& (ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0);
}

// 線分と線分の距離
D dSS(L s, L t)
{
	if (iSS(s, t)) return 0;
	return min(min(dSP(t, s.a), dSP(t, s.b)), min(dSP(s, t.a), dSP(s, t.b)));
}

// 線分と線分の交点 (公差していることが前提)
P cSS(L s, L t)
{
	D d1 = dLP(t, s.a);
	D d2 = dLP(t, s.b);
	D tmp = d1 / (d1 + d2);
	return s.a + (s.b-s.a)*tmp;
}

// 直線と直線の交差判定
bool iLL(L s, L t)
{
	return sig(cross(s.b-s.a, t.b-t.a))!=0;
}

// 直線と直線の交点 iLLを確認してから使用
P cLL(L s, L t)
{
	P ss = s.b - s.a, tt = t.b - t.a;
	return s.a + ss*cross(tt, t.a-s.a)/cross(tt, ss);
}

// 多角形
typedef vector<P> G;
#define GET(v, i) v[i%v.size()]

int containsGP(G g, P p)
{
	bool in=false;
	for (int i=0; i<g.size(); i++) {
		P a = GET(g, i)-p, b = GET(g, i+1)-p;
		if (ccw(a, b, p) == ON) return ON;
		if (a.Y > b.Y) swap(a, b);
		if (a.Y<0 && b.Y>=0 && sig(cross(a, b))>0) in = !in;
	}
	return in?IN:OUT;
}

/** Problem0012 : A Point In Triangle **/
int main()
{
	P a, b, c, p;
	while (cin>>a.X>>a.Y>>b.X>>b.Y>>c.X>>c.Y>>p.X>>p.Y) {
		G g;
		g.push_back(a);
		g.push_back(b);
		g.push_back(c);
		cout << (containsGP(g, p)==IN|ON?"YES":"NO") << endl;
	}
}

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

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;

	while (cin >> x1 >> y1
		       >> x2 >> y2 
		       >> x3 >> y3
		       >> xp >> yp) {

		double l1_x = (y2 - y3);
		double l1_y = -(x2 - x3);
		double l1_c = -(y2 - y3)*x3 + y3;
		
		double l2_x = (y1 - y3);
		double l2_y = -(x1 - x3);
		double l2_c = -(y1 - y3)*x3 + y3;

		double l3_x = (y1 - y2);
		double l3_y = -(x1 - x2);
		double l3_c = -(y1 - y2)*x2 + y2;

		if ((l1_x * xp + l1_y * yp + l1_c)*l1_c >= 0 &&
			(l2_x * xp + l2_y * yp + l2_c)*l2_c >= 0 &&
			(l3_x * xp + l3_y * yp + l3_c)*l3_c >= 0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include <stdio.h>

int sgn(double val)
{
    if(val==0)return 0;
    if(val>0)return 1;
    if(val<0)return -1;
    return -0x7fffffff-1;
}

bool inSameSide(double lx1,double ly1,double lx2,double ly2,
                double tx1,double ty1,double tx2,double ty2)
{
    double nvec[2]={ly1-ly2,lx2-lx1};// 法線vector
    double tp1=tx1*nvec[0]+ty1*nvec[1],
    tp2=tx2*nvec[0]+ty2*nvec[1],
    lp=lx1*nvec[0]+ly1*nvec[1];
    return sgn(tp1-lp)==sgn(tp2-lp);
}

int main(void)
{
    double x1,x2,x3,xp,y1,y2,y3,yp;
    while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)
          ==8)
    {
        bool result=inSameSide(x1,y1,x2,y2,x3,y3,xp,yp)
        &&inSameSide(x2,y2,x3,y3,x1,y1,xp,yp)
        &&inSameSide(x3,y3,x1,y1,x2,y2,xp,yp);
        printf("%s\n",result?"YES":"NO");
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <utility>
#include <queue>
#include <stdio.h>
#include <string>
#include <map>
#include <stack>
#include <complex>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000007
const double eps = 1e-11;
using namespace std;
typedef long long int ll;
typedef complex<double> xy;

int main(){
    double x1,y1,x2,y2,x3,y3,px,py;
    while(cin >> x1 >>y1>>x2>>y2>>x3>>y3>>px>>py){
        xy aa=xy(x1-px,y1-py),bb=xy(x2-px,y2-py),cc=xy(x3-px,y3-py);
        double a,b,c;
        a =((conj(aa)*bb).imag());
        b =((conj(bb)*cc).imag());
        c =((conj(cc)*aa).imag());
        cout << (abs(a)+abs(b)+abs(c)==abs(a+b+c) ? "YES" : "NO")<<endl;
    }
}

C++: #include<iostream>

using namespace std;

int main(){
    double x1, x2, x3, x4, y1, y2, y3, y4;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4) {
        bool flag[2] = {true, true};
        
        if( (x2 - x1) * (y4 - y1) - (x4 - x1) * (y2 - y1) < 0 )
		flag[0] = false;
		
        else 
		flag[1]=false;
		
        if( (x3-x2) * (y4 - y2) - (x4 - x2) * (y3 - y2) < 0 )
		flag[0] = false;
		
        else 
		flag[1]=false;
		
        if( (x1 - x3) * (y4 - y3) - (x4 - x3) * (y1 - y3) < 0 )
		flag[0] = false;
		
        else 
		flag[1]=false;
		
		if( flag[0] || flag[1] )
		cout << "YES\n";
		else
		cout << "NO\n";
    }
    return 0;
}