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<algorithm>

using namespace std;
#define EPS (1e-10)
struct L{
    L(double xa, double ya, double xb, double yb){
	x1 = xa;
	y1 = ya;
	x2 = xb;
	y2 = yb;
	if(xa-xb == 0){
	    a = 1;
	    b = 0;
	    c = -xa;
	}
	else {
	    a = (ya-yb);
	    b = (xb-xa);
	    c = -(a*xa + b*ya);
	}
    };
    double f(double x, double y){
	return a*x + b*y + c;
    }
    double a, b, c, x1, x2, y1, y2;//0 = ax + by + c [x1, x2]
};

bool cross(L a, L b){
    return (a.f(b.x1, b.y1) * a.f(b.x2, b.y2) < 0+EPS && 
	    b.f(a.x1, a.y1) * b.f(a.x2, a.y2) < 0+EPS);
}

double x1, y1, x2, y2, x3, y3, xp, yp;

int main(){
    while(cin){
	cin >> x1 >> y1 >> x2 >> y2>> x3 >> y3 >> xp >> yp;
	L a = L(x1, y1, x2, y2);
	L b = L(x1, y1, x3, y3);
	L c = L(x2, y2, x3, y3);
	L p = L(xp, yp, 203, 103.141592);
	int res = 0;
	if(cross(a,p))res++;
	if(cross(b,p))res++;
	if(cross(c,p))res++;
	if(res % 2 == 0)cout << "NO" <<  endl;
	else cout << "YES"<<endl;
    }
    return 0;
}

C++: #include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

bool isAbove(pair<double, double> p1, pair<double, double> p2, pair<double, double> p3) {
	if (p1.first == p2.first) {
		return p3.first > p1.first;
	} else {
		return p3.second > p1.second + (p2.second - p1.second) * (p3.first - p1.first) / (p2.first - p1.first);
	}
}

void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif

	vector<pair<double, double>> vertices(4);
	while (cin >> vertices[0].first) {
		cin >> vertices[0].second;
		rep(i, 3) cin >> vertices[i + 1].first >> vertices[i + 1].second;

		bool flag = (isAbove(vertices[0], vertices[1], vertices[2]) == isAbove(vertices[0], vertices[1], vertices[3]));
		flag &= (isAbove(vertices[0], vertices[2], vertices[1]) == isAbove(vertices[0], vertices[2], vertices[3]));
		flag &= (isAbove(vertices[1], vertices[2], vertices[0]) == isAbove(vertices[1], vertices[2], vertices[3]));

		cout << (flag ? "YES" : "NO") << endl;
	}


}




int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	solve();
	return 0;
}

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

class Vec2
{
public:
	double x, y;
	Vec2(double x = 0, double y = 0) : x(x), y(y){}
	Vec2(const Vec2& v) : x(v.x), y(v.y){}
	Vec2 operator+(const Vec2& other) const
	{
		return Vec2(x + other.x, y + other.y);
	}
	Vec2 operator-(const Vec2& other) const
	{
		return Vec2(x - other.x, y - other.y);
	}
	double dot(const Vec2& other) const
	{
		return x * other.x + y * other.y;
	}
	double cross(const Vec2& other) const
	{
		return x * other.y - y * other.x;
	}
};

istream& operator>>(istream& stream, Vec2& v)
{
	stream >> v.x >> v.y;
	return stream;
}

class Triangle
{
public:
	Vec2 p1, p2, p3;
	Triangle(Vec2 p1, Vec2 p2, Vec2 p3) : p1(p1), p2(p2), p3(p3){}
	Triangle() : p1(0, 0), p2(0, 0), p3(0, 0){}
	Triangle(const Triangle&  other) : p1(other.p1), p2(other.p2), p3(other.p3){}
	bool isHit(const Vec2& pos) const
	{
		Vec2 a = p2 - p1;
		Vec2 b = p3 - p2;
		Vec2 c = p1 - p3;
		Vec2 A = pos - p1;
		Vec2 B = pos - p2;
		Vec2 C = pos - p3;
		double x = a.cross(A);
		double y = b.cross(B);
		double z = c.cross(C);

		if (x >= 0 && y >= 0 && z >= 0) return true;
		if (x <= 0 && y <= 0 && z <= 0) return true;
		return false;
	}
};

int main()
{
	Triangle t;
	Vec2 p;
	while (cin >> t.p1 >> t.p2 >> t.p3 >> p)
	{
		if (t.isHit(p)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}