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 <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

#include<complex>
typedef complex<double> Point;

double cross(Point a, Point b){
  return imag(conj(a) * b);
}

int ccw(Point a, Point b, Point c){
  b -= a;
  c -= a;
  if(cross(b, c) > EPS) return +1;
  if(cross(b, c) < -EPS) return -1;
  return 0;
}
// テァツつケテ」ツ?古、ツクツ嘉ィツァツ津・ツスツ「abcテ」ツ?ョテ」ツ?ゥテ」ツ?禿」ツ?ォテ」ツ?づ」ツつ凝」ツ?ョテ」ツ?凝・ツ按、テ・ツョツ堙」ツ?凖」ツつ?
enum { OUT, ON, IN };
int contains(Point a, Point b, Point c, Point p){
  int A = ccw(a, b, p);
  int B = ccw(b, c, p);
  int C = ccw(c, a, p);
  if(A == B && B == C && abs(A) == 1) return IN;
  if(!A || !B || !C) return ON;
  return OUT;
}

int main(){
  Point a, b, c, d;
  while(cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag()){
    int C = contains(a, b, c, d);
    if(C == IN){
      cout << "YES" << endl;
    }else if(C == OUT){
      cout << "NO" << endl;
    }else if(C == ON){
      cout << "ON!" << endl;
    }
  }
  return 0;
}

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

float arean(float x1,float y1,float x2,float y2,float x3,float y3)
{
    float a;
    return a=(x3*(y1-y2)+x1*(y2-y3)+x2*(y3-y1))/2;

}
int main()
{
    float x1,y1,x2,y2,x3,y3,px,py,b,a1,a2,a3;
    freopen("in.txt","r",stdin);
   while(scanf("%d%d%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3,&px,&py)!=EOF)
   {
   cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py;

        b=arean(x1,y1,x2,y2,x3,y3);

        a1=arean(x1,y1,x2,y2,px,py);

        a2=arean(px,py,x2,y2,x3,y3);

        a3=arean(x1,y1,x3,y3,px,py);
        if(b==a1+a2+a3)
        cout<<"YES";
        else
        cout<<"NO";

        cout<<endl;
   }





return 0;
}

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

int main(){
	int i;
	double x[4],y[4],xp,yp;
	double ax,px,ay,py;
	bool left,right;
	
	while(std::cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
		x[3]=x[0];
		y[3]=y[0];
		
		left = false;
		right = false;
		
		for(i=0;i<3;i++){
			ax = x[i+1]-x[i];
			ay = y[i+1]-y[i];
			px = xp - x[i];
			py = yp - y[i];
			if(ax*py-px*ay < 0){
				right = true;
			}else{
				left = true;
			}
		}
		
		if(left^right){
			std::cout << "YES" << std::endl;
		}else{
			std::cout << "NO" << std::endl;
		}
	}
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)


int main(){
    double x1,x2,x3,y1,y2,y3,xp,yp;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
        double d1 = (x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);
        double d2 = (x3-x2)*(yp-y2) - (xp-x2)*(y3-y2);
        double d3 = (x1-x3)*(yp-y3) - (xp-x3)*(y1-y3);
        if (( d1<0 && d2<0 && d3<0 ) || ( d1>0 && d2>0 && d3>0 )) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

C++: 
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <complex>

using namespace std;
typedef complex<double> xy_t;
double x[4], y[4];

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

bool three(double s, double t, double u){
	if(s * t > 0 && s * u > 0) return true;
	else return false;
}


int main(void){
	while(true){
		for (int i = 0; i < 4; ++i){
			cin >> x[i] >> y[i];
		}
		if(!cin) break;

		xy_t a(x[0], y[0]), b(x[1], y[1]), c(x[2], y[2]), p(x[3], y[3]);

		double apb, bpc, cpa;
		apb = cross_product(a - p, b - p);
		bpc = cross_product(b - p, c - p);
		cpa = cross_product(c - p, a - p);

		bool ok = three(apb, bpc, cpa);
		cout << (ok ? "YES" : "NO") << endl;
		
	}
	
    return 0;
}

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


class vector_t {
public:
  double x;
  double y;
  double z;

public:
  vector_t(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {};

public:
  vector_t operator^(const vector_t& v) const {
    return vector_t(y * v.z - z * v.y,
                    z * v.x - x * v.z,
                    x * v.y - y * v.x);
  };
};


class point_t {
public:
  double x;
  double y;
  double z;
  double w;

public:
  point_t(double x = 0, double y = 0, double z = 0, double w = 1) : x(x), y(y), z(z), w(w) {};
  
public:
  vector_t operator-(const point_t& p) const {
    return vector_t(x - p.x, y - p.y, z - p.z);
  };
};


class point_triangle_intersect : public std::unary_function<point_t, bool> {
public:
  point_triangle_intersect(const point_t& p1,
                           const point_t& p2,
                           const point_t& p3) : p1_(p1), p2_(p2), p3_(p3)
  {
  };

public:
  bool operator()(const point_t& p) const {
    if (((p2_ - p1_) ^ (p - p1_)).z >= 0 &&
        ((p3_ - p2_) ^ (p - p2_)).z >= 0 &&
        ((p1_ - p3_) ^ (p - p3_)).z >= 0)
      
      return true;

    if (((p2_ - p1_) ^ (p - p1_)).z <= 0 &&
        ((p3_ - p2_) ^ (p - p2_)).z <= 0 &&
        ((p1_ - p3_) ^ (p - p3_)).z <= 0)
      
      return true;

    return false;
  };

private:
  point_t p1_;
  point_t p2_;
  point_t p3_;
};


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

  while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    point_t p1(x1, y1);
    point_t p2(x2, y2);
    point_t p3(x3, y3);
    point_t p (xp, yp);

    if (point_triangle_intersect(p1, p2, p3)(p)) {
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;
    }
  }
}