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 <bits/stdc++.h>

using namespace std;

#define EPS 1e-10

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}
    Point operator - (const Point &p) const {  return Point(x - p.x, y - p.y); }
};

double dot(const Point &a, const Point &b)
{
    return a.x * b.x + a.y * b.y;
}

double cross(const Point &a, const Point &b)
{
    return a.x * b.y - b.x * a.y;
}

double norm(const Point &p){
    return dot(p, p);
}

#define COUNTER_CLOCKWISE +1
#define CLOCKWISE         -1
#define ONLINE_BACK       +2
#define ONLINE_FRONT      -2
#define ON_SEGMENT        +0
typedef Point Vector;

int ccw(const Point &p0, const Point &p1, const Point &p2)
{
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS)  return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS) return CLOCKWISE;
    if (dot(a, b) < -EPS)   return ONLINE_BACK;
    if (norm(a) < norm(b))  return ONLINE_FRONT;
    return ON_SEGMENT; 
}

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

bool in_triangle(Point *p, Point &xp)
{
    int res = 0;
    for (int i = 0; i < 3; i++) {
        res += ccw(xp, p[i], p[(i+1)%3]);
    }
    return (res == -3 || res == 3);
}

int main()
{
    Point p[3], xp;
    while (cin >> p[0] >> p[1] >> p[2] >> xp) {
        cout << (in_triangle(p, xp) ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)

#define X real()
#define Y imag()
typedef double D;
typedef complex<double>P;

D inprd(const P &a, const P &b){ return (conj(a) * b).X; }
D outprd(const P &a, const P &b){ return (conj(a) * b).Y; }
D sign(D d){ return (d<0)?-1:d>0?1:0; }
 
int main(void){
    CIN_NO_SYNC;
    double x1,y1,x2,y2,x3,y3,xp,yp;
    while(cin >>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
        P p12(x2-x1,y2-y1), p23(x3-x2,y3-y2), p31(x1-x3,y1-y3);
        P p1p(xp-x1,yp-y1), p2p(xp-x2,yp-y2), p3p(xp-x3,yp-y3);
        if(sign(outprd(p12, p1p)) == sign(outprd(p23, p2p)) && sign(outprd(p23, p2p)) == sign(outprd(p31, p3p))){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
signed main() {
	double x1, x2, x3, x4, y1, y2, y3, y4;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4)cout << ((((x1 - x2) * (y4 - y1) - (y1 - y2) * (x4 - x1)) * ((x1 - x2) * (y3 - y1) - (y1 - y2) * (x3 - x1)) > 0) && (((x2 - x3) * (y4 - y2) - (y2 - y3) * (x4 - x2)) * ((x2 - x3) * (y1 - y2) - (y2 - y3) * (x1 - x2)) > 0) && (((x3 - x1) * (y4 - y3) - (y3 - y1) * (x4 - x3)) * ((x3 - x1) * (y2 - y3) - (y3 - y1) * (x2 - x3)) > 0) ? "YES\n" : "NO\n");
}

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

double x[4],y[4];
string judge ();

int main() {
	while ( cin >> x[0] ) {
		for( int i = 0; i < 4; i++ ){
			if ( !i )
				cin >> y[i];
			else
				cin >> x[i] >> y[i];
		}
		
		cout <<  judge () << endl;
		
	}
	return 0;
}

string judge () {
	string res;
	double a,b;
	int n,nn;
	
	for ( int i = 0; i < 3; i++ ) {
		if ( i == 2 ){
			n = '0';
			nn = n + 1;
		}else if ( i == 1 ){
			n = i + 1;
			nn = '0';
		}else{
			n = i + 1;
			nn = n + 1;
		}
		
		if ( x[n] != x[i] ){
			a = (y[n] - y[i]) / (x[n] - x[i]);
			b = (x[i] * y[n] - x[n] * y[i]) / (x[i] - x[n]);
		} else {
			a = '0';
			b = y[i];
		}
		if ( (a * x[3] + b) > y[3] && (a * x[nn] + b) < y[nn] || (a * x[3] + b) < y[3] && (a * x[nn] + b) > y[nn] ) {
			return "NO";
		}
	}
	return "YES";
	
}

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

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);

using Point = complex<double>;
using Polygon = vector<Point>;

inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }

inline bool eq(const Point &a, const Point &b) { return abs(a - b) < EPS; }

inline bool operator<(const Point &a, const Point &b){
    if (sgn(a.real() - b.real()))
        sgn(a.real() - b.real()) < 0;
    return sgn(a.imag() - b.imag());
}

double dot(const Point &a, const Point &b) { return real(conj(a) * b); }

double det(const Point &a, const Point &b) { return imag(conj(a) * b); }

struct Line {
    Point p1, p2;

    Line(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}

    bool operator<(const Line &rhs) const {
        if (eq(p2, rhs.p2))
            return p1 < rhs.p1;
        return p2 < rhs.p2;
    }
    bool operator==(const Line &rhs) const {
        return (eq(p1, rhs.p1) && eq(p2, rhs.p2)) ||
               (eq(p1, rhs.p2) && eq(p2, rhs.p1));
    }
};

bool is_in_a_triangle(Point a, Point b, Point c, Point p){
    double c1 = det(b-a, p-a);
    double c2 = det(c-b, p-b);
    double c3 = det(a-c, p-c);
    if(sgn(c1) == sgn(c2) && sgn(c2) == sgn(c3) && sgn(c1) != 0) return true;
    else return false;
}

int main(){
    double x1,y1,x2,y2,x3,y3,xp,yp;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
        if(is_in_a_triangle(Point(x1,y1),Point(x2,y2),Point(x3,y3),Point(xp,yp)))cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}