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>
using namespace std;
class Vector {
public:
  double x;
  double y;
  Vector(double xx=0,double yy=0) {x=xx;y=yy;}
  Vector operator+(Vector p) ;
  Vector operator-(Vector p);
};
Vector Vector::operator+(Vector p) {
  Vector tmp;
  tmp.x=x+p.x;
  tmp.y=y+p.y;
  return tmp;
}
Vector Vector::operator-(Vector p) {
  Vector tmp;
  tmp.x=x+p.x;
  tmp.y=y+p.y;
  return tmp;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P);

int main() {
  double x1,x2,x3,y1,y2,y3,x,y;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y) {
    Vector A(x1,y1);
    Vector B(x2,y2);
    Vector C(x3,y3);
    Vector P(x,y);
    if(check_hit(A,B,C,P))
      cout<<"YES\n";
    else
      cout<<"NO\n"; 
   }
  return 0;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P) {
  Vector AB=B-A;
  Vector BC=C-B;
  Vector CA=A-C;
  Vector AP=P-A;
  Vector BP=P-B;
  Vector CP=P-C;
  double calc1=AB.x*BP.y - AB.y*BP.x;
  double calc2=BC.x*CP.y - BC.y*CP.x;
  double calc3=CA.x*AP.y - CA.y*AP.x;
  if( (calc1>0 && calc2>0 && calc3>0)||(calc1<0 && calc2<0 && calc3<0) )
    return true;
  return false;
      }

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

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();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

double crp(double x1, double y1, double x2, double y2) {
	return x1 * y2 - y1 * x2;
}

double vabs(double x, double y) {
	return sqrt(x * x + y * y);
}

int main() {
	for(double x1, y1, x2, y2, x3, y3, xp, yp; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;) {
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;

		y1 -= yp;
		y2 -= yp;
		y3 -= yp;

		double v1 = vabs(x1, y1);
		double v2 = vabs(x2, y2);
		double v3 = vabs(x3, y3);

		double rad_a = crp(x1, y1, x2, y2) / (v1 * v2);
		double rad_b = crp(x2, y2, x3, y3) / (v2 * v3);
		double rad_c = crp(x3, y3, x1, y1) / (v3 * v1);

		if((rad_a > 0.0 && rad_b > 0.0 && rad_c > 0.0) || (rad_a < 0.0 && rad_b < 0.0 && rad_c < 0.0)) puts("YES");
		else puts("NO");
	}
	return 0;
}

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.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;
	}
}

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

#define x first
#define y second
#define EPS 1e-20

struct vector { double x, y, l; };

int main()
{
    pair<double, double> p[4];

    while (~scanf("%lf %lf", &p->x, &p->y)){
        vector v[3];
        double angle[3];

        for (int i = 1; i < 4; i++) scanf("%lf %lf", &p[i].x, &p[i].y);
        for (int i = 0; i < 3; i++){
            v[i].x = p[i].x - p[3].x;
            v[i].y = p[i].y - p[3].y;
            v[i].l = sqrt(v[i].x * v[i].x + v[i].y * v[i].y);
        }
        for (int i = 0; i < 3; i++){
            double product = v[i].x * v[(i + 1) % 3].x + v[i].y * v[(i + 1) % 3].y;
            angle[i] = acos(product / v[i].l / v[(i + 1) % 3].l) + EPS;
        }

        if (angle[0] + angle[1] + angle[2] == 2 * M_PI + EPS){
            puts("YES");
        }
        else {
            puts("NO");
        }
    }

    return 0;
}