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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<cmath>
using namespace std;

class Biv {
private:
  void set(Biv v) {
    x = v.x; y = v.y;
  }
public:
  string toString() {
    stringstream ss;
    ss << "(" << x << ", " << y << ")";
    return ss.str();
  }
  double x, y;
  Biv(double xx, double yy) {
    x = xx; y = yy;
  }
  Biv() {
    x = 0; y = 0;
  }
  void operator=(Biv v) { set(v); }
  Biv operator-() {
    return Biv(-x, -y);
  }
  Biv operator+(Biv v) {
    return Biv(x + v.x, y + v.y);
  }
  Biv operator-(Biv v) {
    return *this + (-v);
  }
  Biv multiple(double k) {
    return Biv(k * x, k * y);
  }
  Biv operator+=(Biv v) {
    set(*this + v); return *this;
  }
  Biv operator-=(Biv v) {
    set(*this - v); return *this;
  }
  friend ostream& operator<<(ostream& os, const Biv& v);
  double length() {
    return sqrt(x * x + y * y);
  }
  double arg() {
    if (x == 0) { return (y < 0) ? - M_PI / 2: M_PI / 2; }
    double val = atan(y / x);
    return (val > 0)? val:(M_PI + val);
  }
};

double dot(Biv a, Biv b) {
  return a.x * b.x + a.y * b.y;
}

double cross(Biv a, Biv b) {
  return a.x * b.y - a.y * b.x;
}

class Ttm {
private:
  void set(Ttm m) {
    a = m.a; b = m.b; c = m.c; d = m.d;
  }
public:
  double a, b, c, d;
  string toString() {
    stringstream ss;
    ss << "[" << a << "," << b << "," << c << "," << d << "]";
    return ss.str();
  }
  Ttm(double aa, double bb, double cc, double dd) {
    a = aa; b = bb; c = cc; d = dd;
  }
  Ttm() {
    a = 0; b = 0; c = 0; d = 0;
  }
  void operator=(Ttm m) { set(m); }
  Ttm operator-() {
    return Ttm(-a, -b, -c, -d);
  }
  Ttm operator+(Ttm m) {
    return Ttm(a+m.a, b+m.b, c+m.c, d+m.d);
  }
  Ttm operator-(Ttm m) {
    return *this + (-m);
  }
  Ttm operator*(Ttm m) {
    return Ttm(a*m.a+b*m.c, a*m.b+b+m.d, c*m.a+d*m.c, c*m.d+d*m.d);
  }
  Biv operator*(Biv v) {
    return Biv(a * v.x + b * v.y, c * v.x + d * v.y);
  }
  Ttm multiple(double k) {
    return Ttm(k*a, k*b, k*c, k*d);
  }
  Ttm operator+=(Ttm m) {
    set(*this + m); return *this;
  }
  Ttm operator-=(Ttm m) {
    set(*this - m); return *this;
  }
};

Ttm Rotate(double t) {
  return Ttm(cos(t), -sin(t), sin(t), cos(t));
}

bool in(Biv a, Biv b, Biv c, Biv p) {
  b -= a;
  c -= a;
  p -= a;
  
  if (cross(b,p) * cross(c,p) >= 0) {
     /*cout << "cross(" << b.toString() << "," << p.toString()
      << ") * cross(" << c.toString() << "," << p.toString() << ") > 0" << endl;*/
    return false; }
  /*cout << (c - b).toString() << endl;*/
  double t = (c - b).arg();
  /*cout << t << " "<< Rotate(-t).toString() << endl;*/
  b = Rotate(-t) * b;
  c = Rotate(-t) * c;
  p = Rotate(-t) * p;
  /*cout << "c="<<c.toString() << " ,p=" <<p.toString()<<endl;*/

  return p.y > c.y;
}


int main() {
  Biv p1, p2, p3, pp;

  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> pp.x >> pp.y) {
    bool yes = in(p1, p2, p3, pp);

    cout << ( yes ? "YES" : "NO") << endl;
  }
}

C++: #include <iostream>

struct Vec2D{
				double x,y;
};

Vec2D vector(double x1,double y1,double x2,double y2){
				Vec2D vec;
				vec.x = x2 -x1;
				vec.y = y2 -y1;
				return vec;
}

double outerProduct(Vec2D a,Vec2D b){
				double crossProduct = a.x * b.y - a.y * b.x;
				return crossProduct;
}

int main(int argc, char *argv[])
{
	double x1,x2,x3,y1,y2,y3,x,y;

	while(std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y){

		Vec2D BA = vector(x2,y2,x1,y1);
		Vec2D CB = vector(x3,y3,x2,y2);
		Vec2D AC = vector(x1,y1,x3,y3);


		Vec2D BP = vector(x2,y2,x,y);
		Vec2D CP = vector(x3,y3,x,y);
		Vec2D AP = vector(x1,y1,x,y);

		double a,b,c;

		a = outerProduct(BA,BP);
		b = outerProduct(CB,CP);
		c = outerProduct(AC,AP);



		if((a<0 && b<0 && c<0) || (a>0 && b>0 && c>0)){
					std::cout << "YES" << std::endl;
		}else{
					std::cout << "NO" << std::endl;
		}

	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

typedef complex<double> P;

double cross(P a, P b){
	return a.real()*b.imag() - a.imag()*b.real();
}
int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp; // a x b  = ax*by - ay*bx
	while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)){
		P ta(x1,y1), tb(x2,y2), tc(x3,y3), td(xp,yp);

		double f1 = cross(ta-tb,td-tb);
		double f2 = cross(tb-tc,td-tc);
		double f3 = cross(tc-ta,td-ta);
		
		if( (f1+EPS<0.0 && f2+EPS<0.0 && f3+EPS<0.0) || (f1-EPS>0.0 && f2-EPS>0.0 && f3-EPS>0.0) ){
			puts("YES");
		}else{
			puts("NO");
		}

	}
	return 0;
}

C++: /*
 * Problem     : AOJ0010
 * Title       : A Point in a Triangle
 * Author      : mizo0203
 * Copyright   : Your copyright free
 * Description : 三角形による包含判定
 *               http://www5d.biglobe.ne.jp/~tomoya03/shtml/algorithm/Hougan.htm
 */

#include <stdio.h>
#include <math.h>
using namespace std;

typedef struct point {
  double x;
  double y;
} POINT;

POINT t[3], p;

bool input() {
  int i;

  for (i = 0; i < 3; i++) {
    if (scanf("%lf %lf", &t[i].x, &t[i].y) == EOF) return false;
  }
  scanf("%lf %lf", &p.x, &p.y);

  return true;
}

double intersectM(POINT p1, POINT p2, POINT p3, POINT p4) {
  return ((p1.x - p2.x) * (p3.y - p1.y) + (p1.y - p2.y) * (p1.x - p3.x))
      * ((p1.x - p2.x) * (p4.y - p1.y) + (p1.y - p2.y) * (p1.x - p4.x));
}

bool PosIncludeTriEx(POINT tp1, POINT tp2, POINT tp3, POINT xp) {

  if ((tp1.x - tp3.x) * (tp1.y - tp2.y) == (tp1.x - tp2.x) * (tp1.y - tp3.y))
    return false;

  if (intersectM(tp1, tp2, xp, tp3) < 0)
    return false;
  if (intersectM(tp1, tp3, xp, tp2) < 0)
    return false;
  if (intersectM(tp2, tp3, xp, tp1) < 0)
    return false;

  return true;
}

int main() {
  while (input()) {
    if (PosIncludeTriEx(t[0], t[1], t[2], p))
      printf("YES\n");
    else
      printf("NO\n");
  }

  return 0;
}

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

double gaiseki(double x1,double y1,double x2,double y2){

	double ab;
	ab = x1*y2 - y1*x2;
	if (ab>=0)
		ab=1;
	else
		ab=-1;
	return ab;
}

int main() {

	//A(x1,y1,0)
	//B(x2,y2,0)
	//C(x3,y3,0)
	
	double x1,y1,x2,y2,x3,y3,xp,yp;
	
	while(cin >>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		if (  ( gaiseki(x1-x2,y1-y2,xp-x2,yp-y2)+gaiseki(x2-x3,y2-y3,xp-x3,yp-y3)+gaiseki(x3-x1,y3-y1,xp-x1,yp-y1) == 3 )||( gaiseki(x1-x2,y1-y2,xp-x2,yp-y2)+gaiseki(x2-x3,y2-y3,xp-x3,yp-y3)+gaiseki(x3-x1,y3-y1,xp-x1,yp-y1) == -3 )  )
			cout << "YES" <<endl;
		else
			cout << "NO" <<endl;
	}

	return 0;
  
}