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<cstdio>
#include<cmath>
using namespace std;

int main(){
	double a,b,c,d,e,f,p,q;
	bool j;
	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f,&p,&q) != EOF ){
		
			j = true;
			if(a==c){
				if(!(p>a==e>a))j=false;
			}
			else{
				if( !( (q>(b-d)/(a-c)*p-(a*d-b*c)/(c-a))==(f>(b-d)/(a-c)*e-(a*d-b*c)/(c-a)) ) )j=false;
			}
			if(c==e){
				if(!(p>c==a>c))j=false;
			}
			else{
				if(!( (q>(d-f)/(c-e)*p-(c*f-d*e)/(e-c))==(b>(d-f)/(c-e)*a-(c*f-d*e)/(e-c)) ))j=false;
			}
			if(e==a){
				if(!(p>e==c>e))j=false;
			}
			else{
				if(!( (q>(f-b)/(e-a)*p-(e*b-a*e)/(a-e))==(d>(f-b)/(e-a)*c-(e*b-a*f)/(a-e)) ))j=false;
			}
			if(j){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		
	}
	return 0;
}

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

double T(double a[3]) {
	double res, sum;
	res = a[0] + a[1] + a[2];
	sum = res;
	for(int i = 0; i < 3; i++) {
		res *= sum - 2.0 * a[i];
	}
	return sqrt(res);
}

double dist(double ax, double ay, double bx, double by) {
	return sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
}

int main() {
	while(1) {
		bool exit = false;
		double x[4], y[4];
		double d0[3], d1[3];
		for(int i = 0; i < 4; i++) {
			if(!(cin >> x[i] >> y[i]))
				exit = true;
		}
		if(exit)
			break;
		for(int i = 0; i < 3; i++) {
			d0[i] = dist(x[i], y[i], x[(i+1)%3], y[(i+1)%3]);
			d1[i] = dist(x[i], y[i], x[3], y[3]);
		}
		bool flg = true;
		double S0, S1;
		S0 = T(d0); S1 = 0;
		for(int i = 0; i < 3; i++) {
			double res;
			double tmp[3] = {d0[i], d1[i], d1[(i+1)%3]};
			/*
			   for(int i = 0; i < 3; i++)
			   cout << tmp[i] << " ";
			   cout << endl;
			   */
			res = T(tmp);
			if(res < 1e-9)
				flg = false;
			S1 += res;
		}
		//cout << S1 - S0 << endl;
		if(flg && fabs(S1 - S0) < 1e-9)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

C++: #include <complex>
#include <stdio.h>
#include <math.h>
using namespace std;

// _ÀWð^Æ·é
typedef complex<double> P;
// ÎÌè`
#define PI 3.1415926535898

// e·éë·Ã
#define EPS (1e-10)
//XYÀW
#define X real()
#define Y imag()

//QÂÌdouble^Ìlªµ¢©Ç¤©
bool equal(double a, double b){
	return (fabs( a-b ) < EPS)? true : false ;
}
	
// Op`NX
class Triangle{

private:
	//Op`ÌR_ÌÀW
	P a, b, c;
	//Op`ÌRÓÌ·³
	double edgeA,edgeB,edgeC;
	//Op`ÌRpÌå«³(WA)
	double angleA,angleB,angleC;
	//]·è©çRÂÌpxðßéÖ
	double LawOfCosines(double a,double b, double c){
		return acos( (b*b+c*c-a*a) / (2.0*b*c) );
	}
	

public:
	//RXgN^(RÂÌ_ÆÓÆpxðú»)
	Triangle(P p1, P p2, P p3){
		a = p1;
		b = p2;
		c = p3;
		edgeB = abs(c-a);
		edgeA = abs(b-c);
		edgeC = abs(a-b);
		angleA = LawOfCosines(edgeA,edgeB,edgeC);
		angleB = LawOfCosines(edgeB,edgeC,edgeA);
		angleC = LawOfCosines(edgeC,edgeA,edgeB);
	}
	double getAngleC(){//pCÌpxðÏ¦·
		return angleC;
	}
};

int main(){
	double x1, x2, x3, y1, y2, y3, xp, yp, angle;

	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF ){
		P a( x1 , y1 );
		P b( x2 , y2 );
		P c( x3 , y3 );
		P p( xp , yp );
		Triangle Tr1(a,b,p);
		Triangle Tr2(b,c,p);
		Triangle Tr3(c,a,p);
		angle = Tr1.getAngleC() + Tr2.getAngleC() + Tr3.getAngleC();
		if ( equal( 2.0*PI , angle) ){
			printf("YES\n");
		}else {
			printf("NO\n");
		}
	}

	return 0;
}

C++: #include <algorithm>
#include <vector>
#include <complex>
using namespace std;
//---------------------------------------------------------------
using Point = complex<double>;
using Polygon = vector<Point>;
double dot(const Point &a, const Point &b) { return real(conj(a) * b); }
double cross(const Point &a, const Point &b) { return imag(conj(a) * b); }
//---------------------------------------------------------------

#include <iostream>
int main() {
    while (true) {
        vector<double> x(4), y(4);
        for (int i = 0; i < 4; i++) { cin >> x[i] >> y[i]; };
        if (!cin) break;
        Point a(x[0], y[0]), b(x[1], y[1]), c(x[2], y[2]), p(x[3], y[3]);
        double s1 = cross(a - p, b - p);
        double s2 = cross(b - p, c - p);
        double s3 = cross(c - p, a - p);
        bool ok = (s1 > 0 && s2 > 0 && s3 > 0) || (s1 < 0 && s2 < 0 && s3 < 0);
        cout << (ok ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;
#define EPS 1.0e-12
#define F(I,J,N) for(int I=J;I<N;I++)

class Line{
public:
	P p[2];
	P v;
	Line(){}
	Line(P p0,P p1){
		p[0]=p0;
		p[1]=p1;
		v=p1-p0;
	}
	//線分の長さ
	double length(){return abs(v);}
	//平行
	bool Parallel(Line l){
		return (cross(v,l.v)==0);
	}
	//線分上
	bool OnLine(P a){
		return (abs(p[0]-a)+abs(a-p[1])<length()+EPS);
	}
	double cross(Line l){
		return cross(v,l.p[0]-p[0]) * cross(v,l.p[1]-p[0]);
	}
	double cross(P a,P b){
		return (real(a)*imag(b)-imag(a)*real(b));
	}
	bool Intersection(Line l){
		if(Parallel(l)){
			return (OnLine(l.p[0])||OnLine(l.p[1])||l.OnLine(p[0])||l.OnLine(p[1]));
		}
		return ((cross(l)<EPS) && (l.cross(*this))<EPS);
	}
};

class Pi{
private:
	P *p;
	Line *l;
	int n;
public:
	Pi(){}
	Pi(int n){
		this->n=n;
		p=new P[n+1];
		l=new Line[n];
	}
	~Pi(){
		delete []p;
		delete []l;
	}
	void set(int i,P a){
		if(i==0){
			p[0]=a;
			p[n]=a;
		}
		else p[i]=a;
	}
	void set(){
		F(i,0,n) l[i]=Line(p[i],p[i+1]);
	}
	bool isin(P a){
		F(i,0,n) if(l[i].OnLine(a)) return true;
		int cnt=0;
		Line buf(a,P(-1,-1));
		F(i,0,n) if(l[i].Intersection(buf)) cnt++;
		if(cnt&1) return true;
		return false;
	}
};

int main(){
	double a,b,c,d,e,f,g,h;
	P p[3],q;
	Pi *in;
	while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
		p[0]=P(a,b);
		p[1]=P(c,d);
		p[2]=P(e,f);
		q=P(g,h);
		in=new Pi(3);
		F(i,0,3) in->set(i,p[i]);
		in->set();
		if(in->isin(q)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		delete in;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>

using namespace std;

#define D double
 
D heron(D a,D b,D c){
  D s = (a + b + c) / 2;
  D S = sqrt(s*(s - a)*(s - b)*(s - c));
  return S;
}
 
int main(){
  D x1,y1,x2,y2,x3,y3,xp,yp;
   
  while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ){
    D a = sqrt(pow(x1-x2,2) + pow(y1-y2,2));
    D b = sqrt(pow(x1-x3,2) + pow(y1-y3,2));
    D c = sqrt(pow(x3-x2,2) + pow(y3-y2,2));
    D S1 = heron(a,b,c);
     
    D x = sqrt(pow(x1-xp,2) + pow(y1-yp,2));
    D y = sqrt(pow(x2-xp,2) + pow(y2-yp,2));
    D z = sqrt(pow(x3-xp,2) + pow(y3-yp,2));
    D S2 = heron(x,y,a) + heron(x,z,b) + heron(y,z,c);
     
    if ((float)S1 == (float)S2){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }

  return 0;
}