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 <iostream>
#include <algorithm>
using namespace std;

class Vec2
{
public:
	double x, y;
	Vec2(double x = 0, double y = 0) : x(x), y(y){}
	Vec2(const Vec2& v) : x(v.x), y(v.y){}
	Vec2 operator+(const Vec2& other) const
	{
		return Vec2(x + other.x, y + other.y);
	}
	Vec2 operator-(const Vec2& other) const
	{
		return Vec2(x - other.x, y - other.y);
	}
	double dot(const Vec2& other) const
	{
		return x * other.x + y * other.y;
	}
	double cross(const Vec2& other) const
	{
		return x * other.y - y * other.x;
	}
};

istream& operator>>(istream& stream, Vec2& v)
{
	stream >> v.x >> v.y;
	return stream;
}

class Triangle
{
public:
	Vec2 p1, p2, p3;
	Triangle(Vec2 p1, Vec2 p2, Vec2 p3) : p1(p1), p2(p2), p3(p3){}
	Triangle() : p1(0, 0), p2(0, 0), p3(0, 0){}
	Triangle(const Triangle&  other) : p1(other.p1), p2(other.p2), p3(other.p3){}
	bool isHit(const Vec2& pos) const
	{
		Vec2 a = p2 - p1;
		Vec2 b = p3 - p2;
		Vec2 c = p1 - p3;
		Vec2 A = pos - p1;
		Vec2 B = pos - p2;
		Vec2 C = pos - p3;
		double x = a.cross(A);
		double y = b.cross(B);
		double z = c.cross(C);

		if (x >= 0 && y >= 0 && z >= 0) return true;
		if (x <= 0 && y <= 0 && z <= 0) return true;
		return false;
	}
};

int main()
{
	Triangle t;
	Vec2 p;
	while (cin >> t.p1 >> t.p2 >> t.p3 >> p)
	{
		if (t.isHit(p)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;
const double eps=1e-10;

struct vec2{
    double x;
    double y;
    
    vec2()=default;
    vec2(double x_,double y_){
        x=x_;
        y=y_;
    }

    double length() const{//長さ
        return sqrt(x*x+y*y);
    }
    constexpr double lengthsquare() const{//長さの二乗
        return x*x+y*y;
    }
    constexpr double dot(const vec2& other) const{//内積
        return x*other.x+y*other.y;
    }
    constexpr double cross(const vec2& other) const{//外積
        return x*other.y-y*other.x;
    }
    double distancefrom(const vec2& other) const{//otherとの距離
        return (other-*this).length();
    }
    vec2 unitvector() const{//単位ベクトル
        return *this/length();
    }
    vec2 normalunitvector() const{//単位法線ベクトル
        return{-unitvector().y,unitvector().x};
    }
    vec2 rotation(double arg) const{//(0,0)を中心にarg回転
        double cs=cos(arg);double sn=sin(arg);
        return {x*cs-y*sn,x*sn+y*cs};
    }
    double angle() const{//(0,0)を中心としたときの偏角
        return atan2(y,x);
    }
    constexpr bool iszero() const{//原点と一致するか
        return x==0.0 && y==0.0;
    }
    
    vec2 operator+() const{
        return *this;
    }
    vec2 operator-() const{
        return {-x,-y};
    }
    vec2 operator+(const vec2& other) const{
        return {x+other.x,y+other.y};
    }
    vec2 operator-(const vec2& other) const{
        return {x-other.x,y-other.y};
    }
    vec2 operator*(double c) const{
        return {c*x,c*y};
    }
    vec2 operator/(double c) const{
        return {x/c,y/c};
    }
    vec2& operator+=(const vec2& other){
        x+=other.x;
        y+=other.y;
        return *this;
    }
    vec2& operator-=(const vec2& other){
        x-=other.x;
        y-=other.y;
        return *this;
    }
    vec2& operator*=(double c){
        x*=c;
        y*=c;
        return *this;
    }
    vec2& operator/=(double c){
        x/=c;
        y/=c;
        return *this;
    }
};

int sgn(const double a){
    return(a<-eps?-1:(a>eps?1:0));
}

inline vec2 operator*(double s,const vec2& v){
    return {s*v.x,s*v.y};
}
inline bool operator<(const vec2& a, const vec2& b){
    if(sgn(a.x-b.x)!=0)return sgn(a.x-b.x)<0;
    else return sgn(a.y-b.y)<0;
}
int isp(const vec2& a,const vec2& b,const vec2& c){
    //三点A,B,Cの位置関係を示す。全部異なっていることが前提条件。
    //ABから見てBCが左に曲がるなら1, 右に曲がるなら-1
    //ABC(CBA)の順で一直線上に並ぶなら2, ACB(BCA)の順なら0, BAC(CAB)の順なら-2

    int tmp=sgn((b-a).cross(c-a));
    if(tmp==1)return 1;
    else if(tmp==-1)return -1;
    else{
        if(sgn((b-a).dot(c-b))>0)return 2;
        else if(sgn((a-b).dot(c-a))>0)return -2;
        else return 0;
    }
}
int angletype(const vec2& a,const vec2& b,const vec2& c){//1:鋭角,2:直角,3:鈍角
    auto tmp=(a-b).dot(c-b);
    if(sgn(tmp)>0)return 0;
    else if(sgn(tmp)==0)return 1;
    else return 2;
}

int main(){
    double x,y,a,b,c;
    queue<bool> ans;
    while(1){
        vector<vec2> p(4);
        rep(i,4){
            cin>>x>>y;
            p[i]=vec2(x,y);
        }
        if(!cin)break;
        a=(p[0]-p[3]).cross(p[1]-p[3]);
        b=(p[1]-p[3]).cross(p[2]-p[3]);
        c=(p[2]-p[3]).cross(p[0]-p[3]);
        if((a>0&&b>0&&c>0)||(a<0&&b<0&&c<0))ans.push(true);
        else ans.push(false);
    }
    while(ans.size()){
        if(ans.front())cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        ans.pop();
    }
}

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

struct coefficient
{
	double a, b, c;
};

double x[4], y[4];
coefficient line[3];

double det(double a00, double a10, double a01, double a11)
{
	return a00*a11 - a10*a01;
}

void solve()
{
	while (true)
	{
		bool flag = 1;
		for (int i = 0; i < 3; i++)
		{
			if (!(cin >> x[i] >> y[i]))
				return;
		}
		cin >> x[3] >> y[3];

		double t = det(x[1], y[1], x[2], y[2]);
		if (t == 0.0)
		{
			if (x[1] == 0.0 && y[1] == 0.0)
			{
				line[0].a = -y[2] / x[2];
				line[0].b = 1.0;
				line[0].c = 0.0;
			}
			else
				line[0].a = -y[1] / x[1];
				line[0].b = 1.0;
				line[0].c = 0.0;
		}
		else
		{
			line[0].a = det(-1, y[1], -1, y[2]) / t;
			line[0].b = det(x[1], -1, x[2], -1) / t;
			line[0].c = 1.0;
		}

		t = det(x[0], y[0], x[2], y[2]);
		if (t == 0.0)
		{
			if (x[0] == 0.0 && y[0] == 0.0)
			{
				line[1].a = -y[2] / x[2];
				line[1].b = 1.0;
				line[1].c = 0.0;
			}
			else
			{
				line[1].a = -y[0] / x[0];
				line[1].b = 1.0;
				line[1].c = 0.0;
			}
		}
		else
		{
			line[1].a = det(-1, y[0], -1, y[2]) / t;
			line[1].b = det(x[0], -1, x[2], -1) / t;
			line[1].c = 1.0;
		}
	
		t = det(x[1], y[1], x[0], y[0]);
		if (t == 0.0)
		{
			if (x[1] == 0.0 && y[1] == 0.0)
			{
				line[2].a = -y[0] / x[0];
				line[2].b = 1.0;
				line[2].c = 0.0;
			}
			else
			{
				line[2].a = -y[1] / x[1];
				line[2].b = 1.0;
				line[2].c = 0.0;
			}
		}
		else
		{
			line[2].a = det(-1, y[1], -1, y[0]) / t;
			line[2].b = det(x[1], -1, x[0], -1) / t;
			line[2].c = 1.0;
		}
	
		for (int j = 0; j < 3; j++)
		{
			double pmP = line[j].a*x[3] + line[j].b*y[3] + line[j].c;
			double pmT = line[j].a*x[j] + line[j].b*y[j] + line[j].c;
			if (pmP / pmT < 0)
			{
				flag = 0;
				cout << "NO" << endl;
			}
		}
		if (flag)
			cout << "YES" << endl;
	}
}

int main()
{
	solve();
	return 0;
}