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++: #include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cstdio>
#include <string.h>
using namespace std;

#define FOR(i, n) for(int i = 0; i < n; i++)
#define bit(i) static_cast<bitset<8> >(i)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long>PLL;
typedef queue<int> QI;
typedef priority_queue<int> maxpq;
typedef priority_queue<int, vector<int>, greater<int> > minpq;

struct edge{int to, cost;};

void begin(){cin.tie(0); ios::sync_with_stdio(false);};
int gcd(int a, int b){if(a%b==0){return(b);}else{return(gcd(b,a%b));}};
int lcm(int m, int n){if((0 == m)||(0 == n)){return 0;} return ((m / gcd(m, n)) * n);};
unsigned long long comb(long n, long m){unsigned long long c = 1; m = (n - m < m ? n - m : m);
    for(long ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++){c *= ns; c /= ms;} return c;};

// ワーシャルフロイド法
void warshallFloyd(int d[100][100], int n){
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j)
                if(d[i][k] != -1 && d[k][j] != -1){
                    if(d[i][j] == -1){
                        d[i][j] = d[i][k] + d[k][j];
                    }else{
                        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                    }
                }
};


// d:隣接行列  n:グラフのサイズ  s:始点  dist:始点からの距離が入る配列
void dijkstra(int d[1000][1000], int n, int s, int dist[1000]){
    FOR(i, n) dist[i] = -1;
    dist[s] = 0;
    priority_queue<PII, vector<PII>, greater<PII> > q;
    q.push(PII(0, s));
    while (!q.empty()) {
        PII p = q.top(); q.pop();
        int i = p.second;
        if(dist[i] < p.first) continue;
        for(int j = 0; j < n; j++){
            if(d[i][j] == -1) continue;
            if(dist[j] == -1){
                dist[j] = dist[i] + d[i][j];
                q.push(PII(dist[j], j));
            }else if(dist[j] > dist[i] + d[i][j]){
                dist[j] = dist[i] + d[i][j];
                q.push(PII(dist[j], j));
            }
        }
    }
};

// 線分の交差判定
bool isCross(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){
    // 並行な場合
    int m = (x2-x1)*(y4-y3)-(y2-y1)*(x4-x3);
    if(m == 0) return false;
    // 媒介変数の値が0より大きく1以下なら交差する、これは問題の状況によって変わるかも。
    double r =(double)((y4-y3)*(x3-x1)-(x4-x3)*(y3-y1))/m;
    double s =(double)((y2-y1)*(x3-x1)-(x2-x1)*(y3-y1))/m;
    return (0 < r && r <= 1 && 0 < s && s <= 1);
};

// 外積の計算 AB CD
int crossProdct(int ax, int ay, int bx, int by, int cx, int cy, int dx, int dy){
    int abx = bx - ax;
    int aby = by - ay;
    int cdx = cx - dx;
    int cdy = cy - dy;
    return abx * cdy - cdx - aby;
};

double crossProdct(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy){
    double abx = bx - ax;
    double aby = by - ay;
    double cdx = dx - cx;
    double cdy = dy - cy;
    return abx * cdy - cdx - aby;
};

// 三角形の内部判定
bool inTriangle(int ax, int ay, int bx, int by, int cx, int cy, int px, int py){
    int abx = bx - ax;
    int aby = by - ay;
    int bcx = cx - bx;
    int bcy = cy - by;
    int cax = ax - cx;
    int cay = ay - cy;
    
    int apx = px - ax;
    int apy = py - ay;
    int bpx = px - bx;
    int bpy = py - by;
    int cpx = px - cx;
    int cpy = py - cy;
    
    int c1 = abx * bpy - aby * bpx;
    int c2 = bcx * cpy - bcy * cpx;
    int c3 = cax * apy - cay * apx;
    return (c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0);
};

bool inTriangle(double ax, double ay, double bx, double by, double cx, double cy, double px, double py){
    double c1 = crossProdct(ax, ay, bx, by, bx, by, px, py);
    double c2 = crossProdct(bx, by, cx, cy, cx, cy, px, py);
    double c3 = crossProdct(cx, cy, ax, ay, ax, ay, px, py);
    return (c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0);
};

void cp(int a1[], int a2[], int l){FOR(i, l) a2[i] = a1[i];};



/**
 * start
 * @author yoshikyoto
 */
int main(int argc, const char * argv[]){
    begin();
    double ax, ay, bx, by, cx, cy, px, py;
    while(cin >> ax >> ay >> bx >> by >> cx >> cy >> px >> py){
        if(inTriangle(ax, ay, bx, by, cx, cy, px, py)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

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

typedef complex<double> P;

double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

vector<P> ps(3);
P p;

bool isIn() {
  for(int i = 0; i < ps.size(); ++i) {
    P q = ps[i];
    P r = ps[(i+1)%ps.size()];
    if(cross(r-q, p-q) < 0.0) return false;
  }
  return true;
}

int main() {
  while(!cin.eof()) {
    for(int i = 0; i < ps.size(); ++i) {
      cin >> ps[i].real() >> ps[i].imag();
    }
    cin >> p.real() >> p.imag();
    bool flag = false;
    if(isIn() || ( swap(ps[0], ps[1]), isIn() )) {
      cout << "YES" << endl;    
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

double relative(double ax,double ay,double bx,double by){
    return ax*by-ay*bx;
}

int main(void){
    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)){
        double r1=relative(x1-x3, y1-y3, xp-x1, yp-x1);
        double r2=relative(x2-x1, y2-y1, xp-x2, yp-y2);
        double r3=relative(x3-x2, y3-y2, xp-x3, yp-y3);
        if((r1<0&&r2<0&&r3<0) || (r1>0&&r2>0&&r3>0)) cout << "YES" <<"\n";
        else cout << "NO" << "\n";
    }
}

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

struct fPoint
{
    double x;
    double y;
};

float sign(fPoint p1, fPoint p2, fPoint p3)
{
  return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
}

bool PointInTriangle(fPoint pt, fPoint v1, fPoint v2, fPoint v3)
{
  bool b1, b2, b3;

  b1 = sign(pt, v1, v2) < 0.0f;
  b2 = sign(pt, v2, v3) < 0.0f;
  b3 = sign(pt, v3, v1) < 0.0f;

  return ((b1 == b2) && (b2 == b3));
}


int main()
{
    fPoint p1,p2,p3,pp;
    while(cin>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y>>pp.x>>pp.y)
    {
        cout<<(PointInTriangle(pp,p1,p2,p3)?"YES":"NO")<<endl;
    }
}