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()
{
	long double xA , yA , xB , yB , xC , yC , xD , yD;
	while(cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD)
	{
		Vec AB(Point(xA , yA) , Point(xB , yB)) , AC(Point(xA , yA) , Point(xC , yC)) , BC(Point(xB , yB) , Point(xC , yC));
		Vec AD(Point(xA , yA) , Point(xD , yD)) , BD(Point(xB , yB) , Point(xD , yD)) , CD(Point(xC , yC) , Point(xD , yD));
		if(abs(AD.S_vec(BD) + BD.S_vec(CD) + CD.S_vec(AD) - AB.S_vec(AC)) < D3().EPS)
		{
			cout << "YES" << endl;
		} else
		{
			cout << "NO" << endl;
		}

	}
}

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

int gaiseki(double,double,double,double,double,double);

int main() {
	double x[4],y[4];
	int n[3],ans;
	while ( cin >> x[0] ) {
		cin >> y[0];
		for ( int i = 1; i < 4; i++ ) {
			cin >> x[i] >> y[i];
		}
		//三角形の各辺の外積(求めたい点と始点、求めたい点と終点との外積)を取り、全て右か左だったら中に含まれる
		for ( int i = 0; i < 2; i++ ) 
			n[i] = gaiseki(x[i],y[i],x[i + 1],y[i + 1],x[3],y[3]);
		n[2] = gaiseki(x[2],y[2],x[0],y[0],x[3],y[3]);
		
		ans = 0;
		for ( int i = 0; i < 3; i++ ){
			ans += n[i];
		}
		
		if ( ans == 3 || ans == 0 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

int gaiseki(double x1,double y1,double x2,double y2,double xp,double yp) {
	double ans;
	ans =  xp * ( y1 - y2 ) + x1 * ( y2 - yp ) + x2 * ( yp - y1 );
	if ( ans > 0 ) return 1; //右側
	else return 0; //左側(＝だと線上だが、今回は考えなくて良い)
}

C++: #include <iostream>

using namespace std;

struct Vec2d{
  double x,y;
};

double cross(Vec2d &A, Vec2d &B){
  return A.x*B.y - A.y*B.x;
}

int main(void){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
	  Vec2d AB,AP,BC,BP,CA,CP;
	  AB.x = x2-x1;AB.y = y2-y1;
	  BC.x = x3-x2;BC.y = y3-y2;
	  CA.x = x1-x3;CA.y = y1-y3;
	  AP.x = xp-x1;AP.y = yp-y1;
	  BP.x = xp-x2;BP.y = yp-y2;
	  CP.x = xp-x3;CP.y = yp-y3;
	  if(cross(AB,AP)>0.0 && cross(BC,BP)>0.0 && cross(CA,CP)>0.0) cout<<"YES"<<endl;
	  else cout<<"NO"<<endl;
  }
  return 0;
}

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

int main() {
    double x[3], y[3], xp, yp, a, b, c, d;
    while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp) {
        int cnt = 0;
        for (int i=0; i<3; ++i) {
            a = x[(i+1)%3] - x[i];
            b = y[(i+1)%3] - y[i];
            c = xp - x[i];
            d = yp - y[i];
            if (0 < a * d - b * c) cnt ++;
        }
        cout << (cnt % 3 ? "NO" : "YES") << endl;
    }
    return 0;
}