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: M_PI; }
    return atan(y / x);
  }
};

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; }
  
  double t = b.arg();
  /*cout << t << " "<< Rotate(-t).toString() << endl;*/
  c = Rotate(-t) * c;
  p = Rotate(-t) * p;
  /*cout << "c="<<c.toString() << " ,p=" <<p.toString();*/

  return (p.x < c.x);
}


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>
#include <cmath>

using namespace std;

int main() {
	int x1, x2, x3, y1, y2, y3, xp ,yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		int ab = (y2-y1)/(x2-x1)*(xp-x1)+y1-yp;
		int bc = (y3-y2)/(x3-x2)*(xp-x2)+y2-yp;
		int ca = (y1-y3)/(x1-x3)*(xp-x3)+y3-yp;
		if (ab < 0 && bc < 0 && ca > 0) {
			cout << "YES" << endl;
		} else if (ab < 0 && bc > 0 && ca < 0) {
			cout << "YES" << endl;
		} else if (ab > 0 && bc < 0 && ca < 0) {
			cout << "YES" << endl;
		} else if (ab > 0 && bc > 0 && ca < 0) {
			cout << "YES" << endl;
		} else if (ab > 0 && bc < 0 && ca > 0) {
			cout << "YES" << endl;
		} else if (ab < 0 && bc > 0 && ca > 0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <cstdio>           // printf(), scanf()
#include <cmath>            // fabs(), sqrt()
#include <algorithm>        // swap()

using namespace std;
static const double EPS = 1e-10;

class Point
{
public:
	double x, y;

	Point(double x = 0, double y = 0): x(x), y(y) {}
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
};

typedef Point Vector;

double
norm(Vector a)
{
	return a.x * a.x + a.y * a.y;
}

double
abs(Vector a)
{
	return sqrt(norm(a));
}

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


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

Point g[3];
Point p;

bool
solve()
{
	bool f = false;
	for (int i = 0; i < 3; ++i)
	{
		Point a = g[i] - p, b = g[(i + 1) % 3] - p;
		if (abs(cross(a, b)) < EPS && dot(a, b) < EPS)
			return false;

		if (a.y > b.y)
			swap(a, b);

		if (a.y < EPS && EPS < b.y && cross(a, b) > EPS)
			f = !f;
	}

	return f;
}

int
main(int argc, char** argv)
{
	while (true)
	{
		int i;

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

		if (i < 3 || scanf("%lf %lf", &p.x, &p.y) == EOF)
			break;


		printf("%s\n", solve() ? "YES" : "NO");
	}

	return 0;
}

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

xy_t P[4];

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

int main(){
    while(true){
        for(int i = 0; i < 4; i++){
            double x, y; cin >> x >> y;
            P[i] = xy_t(x, y);
        }
        if(!cin) break; //
        double a, b, c; //点Pを中心から三角形の各頂点に伸びるベクトルが作る小三角形の符号付き面積×2を格納
        a = cross_product(P[0]-P[3], P[1]-P[3]);
        b = cross_product(P[1]-P[3], P[2]-P[3]);
        c = cross_product(P[2]-P[3], P[0]-P[3]);

        cout << (((a>0 && b>0 && c>0) || (a<0 && b<0 && c<0))? "YES": "NO") << endl;
    }
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <bitset>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<long long int,long long int> 
#define ff first
#define pb push_back
#define ss second
#define ll long long 
#define ull unsigned long long
#define vi vector<long long int>
#define vii vector<pii>
#define vvi vector <vi>
#define rep(x,a,b,c) for(int x=a;x<=b;x+=c)
#define repp(x,a,b) rep(x,a,b,1)
#define rev(x,a,b,c) for(int x=a;x>=b;x-=c)
#define revv(x,a,b) rev(x,a,b,1)
#define OO (int)2e9
#define INF (ll)1e18
#define EPS (double)1e-5
 
using namespace std;

double x[5],y[5],xx,yy,a,b,c,d,e,f,s,s1,s2,s3,aa,a1,a2,a3;

int main()
{
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3],&xx,&yy)!=EOF)
	{
		a=sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
		b=sqrt((x[2]-x[3])*(x[2]-x[3])+(y[2]-y[3])*(y[2]-y[3]));
		c=sqrt((x[3]-x[1])*(x[3]-x[1])+(y[3]-y[1])*(y[3]-y[1]));
		d=sqrt((xx-x[1])*(xx-x[1])+(yy-y[1])*(yy-y[1]));
		e=sqrt((xx-x[2])*(xx-x[2])+(yy-y[2])*(yy-y[2]));
		f=sqrt((xx-x[3])*(xx-x[3])+(yy-y[3])*(yy-y[3]));
		s=(a+b+c)/(double)2;
		s1=(a+d+e)/(double)2;
		s2=(b+e+f)/(double)2;
		s3=(c+d+f)/(double)2;
		aa=sqrt(s*(s-a)*(s-b)*(s-c));
		a1=sqrt(s1*(s1-a)*(s1-d)*(s1-e));
		a2=sqrt(s2*(s2-b)*(s2-e)*(s2-f));
		a3=sqrt(s3*(s3-c)*(s3-d)*(s3-f));
		if(abs(aa-a1-a2-a3)<=0.0001)
		printf("YES\n");
		else
		printf("NO\n");
	}
	return 0;
}