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 <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second.first
#define T4 second.second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

int main(){
	double x1, x2, x3, y1, y2, y3, xp, yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double a = x2-x1;
		double b = x3-x1;
		double c = xp-x1;
		double d = y2-y1;
		double e = y3-y1;
		double f = yp-y1;
		double s = (c*e-b*f)/(a*e-b*d);
		double t = (a*f-c*d)/(a*e-b*d);
		if(s+t<1 && s>0 && t>0)cout << "YES" << endl;
		else cout <<"NO" <<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

vector<double> simlu_eq(int N, vector<vector<double>> M){
    int i, j, k, n;
    double pivot, mul;
    for (i = 0; i < N; ++i){
        pivot = M[i][i];
        for (j = 0; j < N + 1; ++j){
            M[i][j] = (1 / pivot) * M[i][j];
        }

        for (auto x:M){for(auto y:x){ cout << y << " ";}cout << endl;}

        for (k = i + 1; k < N; ++k){
            mul = M[k][i];
            for (n = i; n < N + 1; ++n){
                M[k][n] = M[k][n] - mul * M[i][n];
            }
        }
    }

     for (i = N -1; i > 0; --i){
         for (k = i -1; k >= 0; --k){
             mul = M[k][i];
             for (n = i; n < N + 1; ++n){
                 M[k][n] = M[k][n] - mul * M[i][n];
             }
         }
     }

   vector<double> res;
    for (i = 0; i < N; ++i){
        res.push_back(M[i][N]);
    }

    cout << res[0] << " " << res[1] << " " << res[2] << endl;

    return res;
}


int main(){
    vector<double> a(2), b(2), c(2), p(2), ab(2), ac(2), ap(2);
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &a[0], &a[1], &b[0], &b[1], &c[0], &c[1], &p[0], &p[1])+1){

        ab[0] = b[0] - a[0];
        ab[1] = b[1] - a[1];
        ac[0] = c[0] - a[0];
        ac[1] = c[1] - a[1];
        ap[0] = p[0] - a[0];
        ap[1] = p[1] - a[1];


    vector<vector<double>>M;
    M = vector<vector<double>>(2, vector<double>(3));
    M[0][0] = ab[0];  M[0][1] = ac[0];  M[0][2] = ap[0];
    M[1][0] = ab[1];  M[1][1] = ac[1];  M[1][2] = ap[1];
    vector<double> w = simlu_eq(2, M);

    if (w[0] > 0 && w[1] > 0 && w[0] + w[1] < 1){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

#define fs first
#define sc second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
const double EPS = 1e-10;

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

struct Point{
	double x, y;
	Point(){}
	Point(double x,double y) :x(x), y(y){}
	Point operator+(Point p) {return Point(x+p.x,y+p.y);}
	Point operator-(Point p) {return Point(x-p.x,y-p.y);}
	Point operator*(double k){return Point(x*k,y*k);}
	Point operator/(double k){return Point(x/k,y/k);}
	double norm(){return x*x+y*y;}
	double abs(){return sqrt(norm());}

	bool operator < (const Point &p) const{
		return x!=p.x?x<p.x:y<p.y;
	}

	bool operator == (const Point &p) const{
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}
};

typedef Point Vector;
typedef vector<Point> Polygon;

double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a,Vector b){
	return a.x * b.y - a.y * b.x;
}

int contains(Polygon g,Point p){
	int n = g.size();
	bool x = false;
	for(int i = 0; i < n; i++){
		Point a = g[i] - p, b = g[(i + 1) % n] - p;
		if(fabs(cross(a, b)) < EPS && dot(a, b) < EPS) return 1;
		if(a.y > b.y) swap(a, b);
		if(a.y < EPS && EPS < b.y && cross(a,b) > EPS ) x = !x;
	}

	return (x ? 2 : 0);
}

int main() {
	Point a, r;
	Polygon v;

	while (cin >> a.x >> a.y) {
		v.clear();
		v.pb(a);
		rep(i, 2) { 
			cin >> a.x >> a.y;
			v.pb(a);
		}
		cin >> r.x >> r.y;

		cout << (contains(v, r) == 2 ? "YES" : "NO") << endl;
	}
}