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>


int main(){
    // ax + y + c = 0
    float x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], xp[100], yp[100], a1, c1, a2, c2, a3, c3;
    int i = 0,n = 0;
    bool f = false;
    while(scanf("%f %f %f %f %f %f %f %f",&x1[i], &y1[i], &x2[i], &y2[i], &x3[i], &y3[i], &xp[i],&yp[i]) != EOF){
        n++;
        i++;
    }
    for(i = 0; i < n; i++){
        f = false;
        if( !( y1[i] == y2[i] || y2[i] == y3[i] || y3[i] == y1[i] )){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if( ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

        }else if(x1[i] == x2[i]){
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if( ( fabs( x1[i] - x3[i] ) > fabs( x1[i] - xp[i] ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

        }else if(x2[i] == x3[i]){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a3 = -( y1[i] - y3[i] ) / ( x1[i] - x3[i] );
            c3 = -a3 * x3[i] - y3[i];

            if( ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( fabs( x2[i] - x1[i] ) > fabs( x2[i] - xp[i] ) )
                    && ( ( fabs( a3 * x2[i] + y2[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) > ( fabs( a3 * xp[i] + yp[i] + c3 ) / sqrt( a3 * a3 + 1.0 ) ) ) )
                f = true;

       }else if(x3[i] == x1[i]){
            a1 = -( y2[i] - y1[i] ) / ( x2[i] - x1[i] );
            c1 = -a1 * x1[i] - y1[i];
            a2 = -( y3[i] - y2[i] ) / ( x3[i] - x2[i] );
            c2 = -a2 * x2[i] - y2[i];

            if( ( ( fabs( a1 * x3[i] + y3[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) > ( fabs( a1 * xp[i] + yp[i] + c1 ) / sqrt( a1 * a1 + 1.0 ) ) )
                    && ( ( fabs( a2 * x1[i] + y1[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) > ( fabs( a2 * xp[i] + yp[i] + c2 ) / sqrt( a2 * a2 + 1.0 ) ) )
                    && ( fabs( x3[i] - x2[i] ) > fabs( x3[i] - xp[i] ) ) )
                f = true;

       }
        if(f){
            printf("YES\n");
        }else{
            printf("NO\n");
        }

    }
    return 0;
}

C++: 
#include<iostream>
#include <math.h>
#include<cstdio>
using namespace std;

//???????????????
struct Vertex2D{
	double x;
	double y;
};
//?????????????????????(????????¨??????)
#define Vector2D Vertex2D

//???????????¢
double distance_vertex(Vertex2D p1, Vertex2D p2) {
	return pow( ( p2.x - p1.x ) * ( p2.x - p1.x ) + ( p2.y - p1.y ) * ( p2.y - p1.y ), 0.5 );
}

//??????????????????
double cross_vector(Vector2D vl, Vector2D vr) {
	return vl.x * vr.y - vl.y * vr.x;
}

//???P??¨???(AB)????????¢
double Distance_DotAndLine(Vertex2D P, Vertex2D A, Vertex2D B )
{
	Vector2D AB,AP;

	AB.x = B.x - A.x;
	AB.y = B.y - A.y;
	AP.x = P.x - A.x;
	AP.y = P.y - A.y;

	//????????????AB???AP??????????????¶???????????????????????¢D?????¢????????????
	double D =  cross_vector( AB, AP );

	double L = distance_vertex( A, B );	//AB???????????¢

	double H = D / L;
	return H;

}


int main(){

	struct  Vertex2D point[4];

	while(	scanf("%lf %lf %lf %lf %lf %lf %lf %lf ",&point[0].x , &point[0].y,
													 &point[1].x , &point[1].y,
													 &point[2].x , &point[2].y,
													 &point[3].x , &point[3].y) != EOF){
	int check = 0;
	for(int i=0;i<3;i++){
		double tmp =  Distance_DotAndLine(point[i%3],point[(i+1)%3],point[3]);
		if(tmp < 0){
			check--;
		}else{
			check++;
		}
	}
	if(check == 3 or check == -3){
		cout << "YES" << endl;

	}else{
		cout << "NO" << endl;

	}
	}
	return 0;
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,px,py;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py){
    double s1=0,s2=0,s3=0,s=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,a2=0,b2=0,c2=0,a3=0,b3=0,c3=0;
    a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s=(a+b+c)/2;
    s=sqrt(s*(s-a)*(s-b)*(s-c));
    cout<<s<<endl;

    a1=sqrt((px-x2)*(px-x2)+(py-y2)*(py-y2));
    b1=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c1=sqrt((x3-px)*(x3-px)+(y3-py)*(y3-py));
    s1=(a1+b1+c1)/2;
    s1=sqrt(s1*(s1-a1)*(s1-b1)*(s1-c1));
    cout<<s1<<endl;

    a2=sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py));
    b2=sqrt((px-x3)*(px-x3)+(py-y3)*(py-y3));
    c2=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s2=(a2+b2+c2)/2;
    s2=sqrt(s2*(s2-a2)*(s2-b2)*(s2-c2));
    cout<<s2<<endl;

    a3=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b3=sqrt((x2-px)*(x2-px)+(y2-py)*(y2-py));
    c3=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    s3=(a3+b3+c3)/2;
    s3=sqrt(s3*(s3-a3)*(s3-b3)*(s3-c3));
    cout<<s3<<endl;

    if(s1==N||s2==N||s3==N)cout<<"NO"<<endl;
    else if((s1+s2+s3)>s-N &&(s1+s2+s3)<s+N )cout<<"YES"<<endl;
    else  cout<<"NO"<<endl; 
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
bool judge_Cross(int, int,int,int);

int main() {
	float x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		float pax = x1 - xp;
		float pay = y1 - yp;
		float pbx = x2 - xp;
		float pby = y2 - yp;
		float pcx = x3 - xp;
		float pcy = y3 - yp;

		if ((judge_Cross(pax, pay, pbx, pay) && judge_Cross(pbx, pby, pcx, pcy) && judge_Cross(pcx, pcy, pax, pay)) ||
			!((judge_Cross(pax, pay, pbx, pay) || judge_Cross(pbx, pby, pcx, pcy) || judge_Cross(pcx, pcy, pax, pay)))) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

bool judge_Cross(int x1,int y1,int x2,int y2) {
	if (x1 * y2 - x2 * y1 > 0) {
		return true;
	} else {
		return false;
	}
}