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 <bits/stdc++.h>

using namespace std;

class D3
{
public:
	long double X , Y , Z , EPS;

	D3(long double , long double , long double);
	bool operator== (D3 Partner);
	D3 operator*(long double);
	D3 operator/(long double);
};

class Point :private D3
{
public:
	Point(long double , long double , long double);
	long double getX();
	long double getY();
	long double getZ();

	bool operator== (Point);
	long double S_point(Point , Point);
};

class Vec
{
private:
	Point SP;//Starting Point ?§????
	D3 D;//Direction ??????

	Vec(D3 Direction_ , Point SP_);
public:
	Vec(long double x_ , long double y_ , long double z_ , Point);
	Vec operator+(Vec Partner);
	Vec operator*(Vec Partner);
	Vec operator*(long double ld);
	Vec operator-(Vec Partner);
	Vec operator/(Vec Partner);
	Vec operator/(long double);
	bool operator== (Vec);
	Vec Cross_product(Vec);
	double Inner_product(Vec);
	Vec(Point A , Point B);
	Point getSP();
	Point getGP();
	D3 getD();
	long double length();
	Vec Unit_vec();
	Vec Inverse_vec();
	Vec Reverse_vec();
	bool Vertical(Vec);
	bool Parallel(Vec);
	long double S_vec(Vec);
};


//D3

D3::D3(long double x_ = 0.0L , long double y_ = 0.0L , long double z_ = 0.0L)
{
	X = x_;
	Y = y_;
	Z = z_;
	EPS = 1e-9L;
}

bool D3::operator== (D3 Partner)
{
	return abs(X - Partner.X) < EPS&&abs(Y - Partner.Y) < EPS&&abs(Z - Partner.Z) < EPS;
}

D3 D3::operator*(long double ld)
{
	return D3(X*ld , Y*ld , Z*ld);
}

D3 D3::operator/(long double ld)
{
	return  *this*( ld*-1.L );
}


//Point

Point::Point(long double x_ = 0.0L , long double y_ = 0.0L , long double z_ = 0.0L)
{
	X = x_;
	Y = y_;
	Z = z_;
}

//x??§?¨??????????
long double Point::getX()
{
	return X;
}

//y??§?¨??????????
long double Point::getY()
{
	return Y;
}

//z??§?¨??????????
long double Point::getZ()
{
	return Z;
}

bool Point::operator== (Point Partner)
{
	return D3(*this) == D3(Partner);
}
//??????????????¢???????±???????
long double Point::S_point(Point B , Point C)
{
	Vec AB(*this , B) , AC(*this , C);
	return AB.S_vec(AC);
}


//Vec

//??????????????¨?§???????????????????????????????
Vec::Vec(D3 Direction_ , Point SP_)
{
	D = Direction_;
	SP = SP_;
}

//?§??????¨???????????????????????????????????????????????????
Vec::Vec(long double x_ = 0.0L , long double y_ = 0.0L , long double z_ = 0.0L , Point SP_ = Point())
{
	*this = Vec(D3(x_ , y_ , z_) , SP_);
}

Vec Vec::operator+(Vec Partner)
{
	return Vec(D.X + Partner.D.X , D.Y + Partner.D.Y , D.Z + Partner.D.Z , SP);
}

Vec Vec::operator*(Vec Partner)
{
	return Vec(D.X * Partner.D.X , D.Y * Partner.D.Y , D.Z * Partner.D.Z , SP);
}

Vec Vec::operator*(long double ld)
{
	return Vec(D*ld , SP);
}

Vec Vec::operator-(Vec Partner)
{
	return *this + ( Partner*( -1.L ) );
}


Vec Vec::operator/(Vec Partner)
{
	return Vec(D.X / Partner.D.X , D.Y / Partner.D.Y , D.Z / Partner.D.Z , SP);
}

Vec Vec::operator/(long double ld)
{
	return *this*( 1.L / ld );
}

bool Vec::operator== (Vec Partner)
{
	return D == Partner.D&&SP == Partner.SP;
}

//??????
Vec Vec::Cross_product(Vec Partner)
{
	return Vec(D.Y*Partner.D.Z - D.Z*Partner.D.Y , D.Z*Partner.D.X - D.X*Partner.D.Z , D.X*Partner.D.Y - D.Y*Partner.D.X);
}

//??????
double Vec::Inner_product(Vec Partner)
{
	return D.X*Partner.D.X + D.Y*Partner.D.Y + D.Z*Partner.D.Z;
}

//???????????????????????????????????????
Vec::Vec(Point A , Point B)
{
	*this = Vec(B.getX() - A.getX() , B.getY() - A.getY() , B.getZ() - A.getZ() , A);
}

//?§?????????????
Point Vec::getSP()
{
	return SP;
}

//???????????????
Point Vec::getGP()
{
	return Point(SP.getX() + D.X , SP.getZ() + D.Z , SP.getZ() + D.Z);
}

//???????????????
D3 Vec::getD()
{
	return D;
}

//???????????????
long double Vec::length()
{
	return sqrtl(D.X*D.X + D.Y*D.Y + D.Z*D.Z);
}

//??????????????????(??????1)?????????
Vec Vec::Unit_vec()
{
	return Vec(*this) / ( *this ).length();
}

//????????????????????????(?§??????????????????????)
Vec Vec::Inverse_vec()
{
	return ( *this )*-1.L;
}

//????????????????????????(?§??????¨???????????\????????????)
Vec Vec::Reverse_vec()
{
	return Vec(( *this ).Inverse_vec().getD() , ( *this ).getGP());
}

//?????´????????????
bool Vec::Vertical(Vec Partner)
{
	return ( *this ).Inner_product(Partner) == 0;
}

//??????????????????
bool Vec::Parallel(Vec Partner)
{
	return ( *this ).Unit_vec().getD() == Partner.Unit_vec().getD() || ( *this ).Unit_vec().Inverse_vec().getD() == Partner.Unit_vec().getD();
}

//???????§????2????????????????????¢???????±???????
long double Vec::S_vec(Vec B)
{
	//if(( ( *this ).getSP() == B.getSP() ))
	{
		Vec G = ( *this ).Cross_product(B);
		return sqrtl(G.Inner_product(G)) / 2.L;
	}
	if(( *this ).getGP() == B.getSP())
	{
		return ( *this ).Reverse_vec().S_vec(B);
	}
	if(( *this ).getSP() == B.getGP())
	{
		return ( *this ).S_vec(B.Reverse_vec());
	}
	if(( *this ).getGP() == B.getGP())
	{
		return ( *this ).Reverse_vec().S_vec(B.Reverse_vec());
	}

	return -1.L;
}

int main()
{
	double x1 , y1 , x2 , y2 , x3 , y3 , xp , yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
	{
		D3 X(x1 , y1) , Y(x2 , y2) , Z(x3 , y3) , P(xp , yp) , calc;
		if(abs(calc.S_point(X , Y , Z) - ( calc.S_point(X , Y , P) + calc.S_point(X , Z , P) + calc.S_point(Z , Y , P) )) < 1e-6)
		{
			cout << "YES" << endl;
		} else
		{
			cout << "NO" << endl;
		}
	}
}

C++: #include <stdio.h>
#include <math.h>

using namespace std;


int main(){
	double x1,x2,x3,y1,y2,y3,xp,yp;
	double dist1,dist2,dist3,p_dist1,p_dist2,p_dist3;

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		//(x3,y3)????????¢:(y2-y1)*x+(x1-x2)*y+(y1*(x2-x1)-x1*(y2-y1))
		//(x1,y1)????????¢:(y2-y3)*x+(x3-x2)*y+(y3*(x2-x3)-x3*(y2-y3))
		//(x2,y2)????????¢:(y3-y1)*x+(x1-x3)*y+(y1*(x3-x1)-x1*(y3-y1));
		dist1 = fabs((y2-y3)*x1+(x3-x2)*y1+(y3*(x2-x3)-x3*(y2-y3)))/sqrt((y2-y3)*(y2-y3)+(x3-x2)*(x3-x2));
		dist2 = fabs((y3-y1)*x2+(x1-x3)*y2+(y1*(x3-x1)-x1*(y3-y1)))/sqrt((y3-y1)*(y3-y1)+(x1-x3)*(x1-x3));
		dist3 = fabs((y2-y1)*x3+(x1-x2)*y3+(y1*(x2-x1)-x1*(y2-y1)))/sqrt((y2-y1)*(y2-y1)+(x1-x2)*(x1-x2));

		p_dist1 = fabs((y2-y3)*xp+(x3-x2)*yp+(y3*(x2-x3)-x3*(y2-y3)))/sqrt((y2-y3)*(y2-y3)+(x3-x2)*(x3-x2));
		p_dist2 = fabs((y3-y1)*xp+(x1-x3)*yp+(y1*(x3-x1)-x1*(y3-y1)))/sqrt((y3-y1)*(y3-y1)+(x1-x3)*(x1-x3));
		p_dist3 = fabs((y2-y1)*xp+(x1-x2)*yp+(y1*(x2-x1)-x1*(y2-y1)))/sqrt((y2-y1)*(y2-y1)+(x1-x2)*(x1-x2));

		if(p_dist1 < dist1 && p_dist2 < dist2 && p_dist3 < dist3){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
    return 0;
}