Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: //template
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

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

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl
#define CIN(x) cin>>(x)

int main(){

	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){

		//A点を原点に移動
		x2 -= x1; y2 -= y1;
		x3 -= x1; y3 -= y1;
		xp -= x1; yp -= y1;

		double k1, k2;
		k2 = (yp - (xp / x2)*y2) / (y3 - (x3 / x2)*y2);
		k1 = (xp - k2*x3) / x2;

		if ((k1 > 0) && (k2 > 0) && (k1 + k2 < 1)) COUT("YES");
		else COUT("NO");
	}

	return 0;

}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
typedef complex<double> xy_t;

double x[4], y[4];

double dot_product(xy_t a, xy_t b)
{
    return (conj(a) * b).real();
}

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

int main()
{
    while (true)
    {
        rep(i, 4) 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 pab = cross_product(a - p, b - p), pbc = cross_product(b - p, c - p), pca = cross_product(c - p, a - p);
        bool ok = pab * pbc > 0 && pbc * pca > 0;
        cout << (ok ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
double hoge(double x1,double y1,double x2, double y2){
  double a,b,c;
  a=max(x1,x2)-min(x1,x2);
  b=max(y1,y2)-min(y1,y2);
  c=(a*a)+(b*b);
  c=sqrt(c);
  return c;
}
double heron(double a,double b,double c){
  double s,S;
  s=(a+b+c)/2;
  S=s*(s-a)*(s-b)*(s-c);
  S=sqrt(S);
  return S;
}
int main(void){
  double x1,x2,x3,y1,y2,y3,xp,yp,ab,bc,ac,ap,bp,cp,abc,apb,bpc,apc,sum;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    ab=hoge(x1,y1,x2,y2);
    bc=hoge(x2,y2,x3,y3);
    ac=hoge(x1,y1,x3,y3);
    ap=hoge(x1,y1,xp,yp);
    bp=hoge(x2,y2,xp,yp);
    cp=hoge(x3,y3,xp,yp);
    abc=heron(ab,bc,ac);
    apb=heron(ap,bp,ab);
    bpc=heron(bp,cp,bc);
    apc=heron(ap,cp,ac);
    sum=apb+bpc+apc;
    if(max(abc,sum)-min(abc,sum)<=0.000000001) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}