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 <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

struct vector2D
{
	double x, y;

	vector2D(double x, double y)
	{
		this->x = x;
		this->y = y;
	}
};

vector2D vec(double ax, double ay, double bx, double by)
{
	return vector2D(bx - ax, by - ay);
}

double outer(vector2D a, vector2D b)
{
	return a.x * b.y - a.y * b.x;
}

int main()
{
	vector<double> x(3);
	vector<double> y(3);
	double xp, yp;
	for (;cin >> x.at(0) >> y.at(0) >> x.at(1) >> y.at(1) >> x.at(2) >> y.at(2) >> xp >> yp;)
	{
		vector2D ab = vec(x.at(1), y.at(1), x.at(0), y.at(0));
		vector2D bc = vec(x.at(2), y.at(2), x.at(1), y.at(1));
		vector2D ca = vec(x.at(0), y.at(0), x.at(2), y.at(2));

		vector2D ap = vec(xp, yp, x.at(0), y.at(0));
		vector2D bp = vec(xp, yp, x.at(1), y.at(1));
		vector2D cp = vec(xp, yp, x.at(2), y.at(2));


		if ((outer(ab, bp) >= 0 && outer(bc, cp) >= 0 && outer(ca, ap) >= 0) || (outer(ab, bp) <= 0 && outer(bc, cp) <= 0 && outer(ca, ap) <= 0))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> P;

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

P vector_coord(P a, P b, P x){
  return P(-cross(b,x),cross(a,x))/cross(a,b);
}

int main(){
  double a1,b1,a2,b2,a3,b3,x1,y1;
  while(cin >>a1 >>b1 >>a2 >>b2 >>a3 >>b3>> x1>>y1){
  P o=P(a1,b1);
  P a=P(a2,b2)-o;
  P b=P(a3,b3)-o;
  P x=P(x1,y1);
  P v = vector_coord(a,b,x);
  if (0<v.real()&&0<v.imag()&&v.real()+v.imag()<1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

double distance(double x1, double y1, double x2, double y2,
                double xp, double yp){
    if(x1 == x2) {
        return abs(xp - x1);
    } else {
        double a = ( y2 - y1 ) / ( x2 - x1 );
        double b = y1 - a * x1;
        return abs(a*xp-yp+b) / sqrt(1+a*a);
    }
}


int main(){
    vector<double> p(6);
    double xp, yp;
    while(cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> p[5] >> xp >> yp){
        bool yes = true;
        for(int i = 0; i < 3; i++){
            double d1 = distance(p[0], p[1], p[2], p[3], p[4], p[5]);
            double d2 = distance(p[0], p[1], p[2], p[3], xp, yp);
            yes &= (d2 < d1 && d2 > 0);
            rotate(p.begin(), p.begin()+2, p.end());
        }
        cout << (yes ? "YES" : "NO") << endl;
    }
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	double x[4] = {-1000}, y[4] = {-1000},xp,yp;
	double max_x, min_x, max_y, min_y;
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[1], &y[1], &x[2], &y[2], &x[3], &y[3], &xp, &yp) != EOF){
		
		sort(x, x + 4);
		sort(y, y + 4);
		
		max_x = x[3];
		max_y = y[3];
		min_x = x[1];
		min_y = y[1];
		
		if (min_x < xp && xp < max_x && min_y < yp && yp < max_y){
			printf("YES\n");
		}
		else printf("NO\n");
	}
}

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

int main(){

	typedef struct{
		double x, y;
	}_point;

	double a, b, s, t, r_p3, r_p2, eps;
	_point p1, p2, p3, p;
	
	eps = 10e-6;

  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p.x >> p.y){
		p2.x -= p1.x;
		p2.y -= p1.y;
		p3.x -= p1.x;
		p3.y -= p1.y;
		p.x -= p1.x;
		p.y -= p1.y;
		r_p2 = sqrt(p2.x * p2.x + p2.y * p2.y);
		r_p3 = sqrt(p3.x * p3.x + p3.y * p3.y);
		if(p2.x > eps){
			s = p.y - p.x * p2.y / p2.x;
			t = p3.y - p3.x * p2.y / p2.x;
			a = (s / t);
			b = (p.x - a * p3.x) / p2.x;
		}
		else {
			a = p.x / p3.x;
			b = (p.y - a * p3.y) / p2.y;
		}

		if(a > 0.0 && b > 0.0 && a + b < 1.0) cout << "YES" << endl;
		else cout << "NO" << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>
using namespace std;
double x,y;
double cross(double a,double b,double c,double d)
{
	return a*d-b*c;
}
bool C(double a,double b,double c,double d,double e,double f)
{
	if(cross(a,b,c,d)<0)
	{
		swap(a,c);
		swap(b,d);
	}
	pair<double,int>p[3];
	p[0]=make_pair(atan2(d-b,c-a),2);
	p[1]=make_pair(atan2(f-b,e-a),1);
	p[2]=make_pair(atan2(y-b,x-a),0);
	sort(p,p+3);
	return p[1].second==0;
}
int main()
{
	double a,b,c,d,e,f;
	for(;cin>>a>>b>>c>>d>>e>>f>>x>>y;)
	{
		cout<<(C(a,b,c,d,e,f)&&C(c,d,e,f,a,b)&&C(e,f,a,b,c,d)?"YES":"NO")<<endl;
	}
}