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

using namespace std;
#define EPS (1e-10)
#define ABS(x) ((x)<0?-(x):(x))
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<iostream>
using namespace std;

bool point(double x1, double y1, double x2, double y2, double x3, double y3, double px, double py){
	double a1 = (x2 != x1) ? (y2 - y1) / (x2 - x1) : 100000 * (((y2 - y1) < 0) * 2 - 1 );
	double a2 = (x3 != x1) ? (y3 - y1) / (x3 - x1) : 100000 * (((y3 - y1) < 0) * 2 - 1 );
	double ap = (px != x1) ? (py - y1) / (px - x1) : 100000 * (((py - y1) < 0) * 2 - 1 );
	
	if ((a1 >= ap && a2 <= ap) || (a1 <= ap && a2 >= ap))
		return true;
	else
		return false;
}

int main(){
	double x1, y1, x2, y2, x3, y3, px, py;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py)
		std::cout << ((point(x1, y1, x2, y2, x3, y3, px, py) && point(x2, y2, x3, y3, x1, y1, px, py)) ? "YES" : "NO") << std::endl;

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cmath>
 
using namespace std;

int checkPoint(double x1, double y1, double x2, double y2, double x, double y){
    if(x1 - x2 == 0) if(x - x1 > 0) { return 1; } else return -1;
    if((y - y1) - (y2 - y1) / (x2 - x1) * (x - x1) > 0) { return 1; } else return -1;
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        if(checkPoint(x1, y1, x2, y2, x3, y3) * checkPoint(x1, y1, x2, y2, xp, yp))
            if(checkPoint(x1, y1, x3, y3, x2, y2) * checkPoint(x1, y1, x3, y3, xp, yp))
                if(checkPoint(x2, y2, x3, y3, x1, y1) * checkPoint(x2, y2, x3, y3, xp, yp)) cout << "YES" << endl;
            cout << "NO" << endl;
    }
    return 0;
}

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

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

typedef struct POINT_tag{ double x, y; }POINT_t;
typedef struct LINE_tag{ POINT_t a, b;}LINE_t;
typedef struct TRIAGNLE_tag{ POINT_t a, b, c;}TRIANGLE_t;

int side(POINT_t *p, LINE_t *e){
  POINT_t p1 = *p;
  POINT_t p2 = e->a;
  POINT_t p3 = e->b;

  const int n  = p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y);
  if(n > 0) return 1;
  else if(n < 0)  return -1;
  else return 0;
}

int solve(POINT_t *p, TRIANGLE_t *t){
  LINE_t ab, bc, ca;
  ab.a = t->a; ab.b = t->b;
  bc.a = t->b; bc.b = t->c;
  ca.a = t->c; ca.b = t->a;
  const int pab = side(p, &ab);
  const int pbc = side(p, &bc);
  const int pca = side(p, &ca);

  if((0 < pab) && (0 < pbc) && (0 < pca)) return 1;
  if((0 > pab) && (0 > pbc) && (0 > pca)) return 1;

  return 0;
}

int main(){
  POINT_t p;
  TRIANGLE_t t;
  while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &t.a.x, &t.a.y, &t.b.x, &t.b.y, &t.c.x, &t.c.y, &p.x, &p.y) != EOF){
    if(solve(&p, &t)) puts("YES");
    else puts("NO");
  }
  return 0;
}