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>
using namespace std;

bool f(double x1,double y1,double x2,double y2,double x,double y);



int main(void){
        double x1,y1,x2,y2,x3,y3,xp,yp;
        double xm,ym;
        while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp) {
            xm=(x1+x2+x3)/3;
            ym=(y1+y2+y3)/3;
            if(f(x1,y1,x2,y2,xp,yp)==f(x1,y1,x2,y2,xm,ym) and f(x1,y1,x3,y3,xp,yp)==f(x1,y1,x3,y3,xm,ym) and f(x3,y3,x2,y2,xp,yp)==f(x3,y3,x2,y2,xm,ym)){
                cout<<"YES"<<endl;
            }
            else{
                cout<<"NO"<<endl;
            }

        }
        return 0;
}

bool f(double x1,double y1,double x2,double y2,double x,double y){
    return (y2-y1)*x-(x2-x1)*y-x1*y2+x2*y1 > 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(true){
	REP(i,4) {
	    cin >> x[i];
	    if(cin.eof()) return 0;
	    cin >> y[i];
	}
	double s,t;
	double m = 0;
	bool flg = false;
	    double x1[] =  {x[2] - x[0],  x[1] - x[0]};
	    double y1[] = { y[2] - y[0] , y[1] - y[0]};
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    REP(i,1e3)REP(j,1e3){
		s = (double)i / 1e3;
		t = (double)j / 1e3;
		if(abs(s * x1[0] + t * x1[1] - x2) < 1e-3 && abs(s * y1[0] + t * y1[1] - y2) < 1e-3){
		    flg = true;
		    break;
		}
	    }
//	    double dotpro =  (  (x1 * x2 + y1 * y2 )*(x1 * x2 + y1 * y2 ) )  /( (x1*x1 + y1*y1)*(x2*x2 + y2*y2)) ;

	    if(flg) cout << "YES" << endl;
	    else cout << "NO" << endl;

    }

    return 0;
}

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

using namespace std;

double cross(double,double,double,double);

int main(void){
	double xa,ya,xb,yb,xc,yc,xp,yp;
	while(1){
		cin >> xa;
		if (cin.eof())
			break;
		cin >> ya >> xb >> yb >> xc >> yc >> xp >> yp;
		double abx , aby , bcx , bcy , cax , cay , apx , apy , bpx , bpy , cpx , cpy;
		abx = xb - xa;
		aby = yb - ya;
		bcx = xc - xb;
		bcy = yc - yb;
		cax = xa - xc;
		cay = ya - yc;
		apx = xp - xa;
		apy = yp - ya;
		bpx = xp - xb;
		bpy = yp - yb;
		cpx = xp - xc;
		cpy = yp - yc;
		double fa,fb,fc;
		fa = cross(abx,aby,apx,apy);
		fb = cross(bcx,bcy,bpx,bpy);
		fc = cross(cax,cay,cpx,cpy);
		if ( (fa>0 && fb>0 && fc>0) || (fa<0 && fb<0 && fc<0) )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}


	return 0;
}

double cross(double ax,double ay,double bx,double by){
	return ax*by-ay*bx;
}

C++: #include <iostream>
using namespace std;
double x[4],y[4],px,py,ax,ay,bx,by;
int main()
{
	while(true)
	{
		for(int i = 1;i<=3;i++){cin >> x[i];cin >> y[i];}
		if(cin.eof()){break;}
		cin >> px;
		cin >> py;
		double m,n;
		ax = x[2]-x[1];
		ay = y[2]-y[1];
		bx = x[3]-x[1];
		by = y[3]-y[1];
		double det = ax*by-ay*bx;
		m = (by*px-bx*py)/det;
		n = (-ay*px+ax*py)/det;
		if(m>0 && m <= 1 && n > 0 && n <= 1 && m+n <= 1 ) {cout << "YES" ;}
		else {cout << "NO" ;}
		cout << endl;
	}
	return 0;
}

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




class point{
public:
	double x;
	double y;
	point(double px, double py){
		x = px;
		y = py;
	}
};

double cross(point a, point b, point c, point d){
	return (b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x);
}

bool pn(double a){
	if (a > 0)
		return true;
	else
		return false;
}

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		point a = point(x1, y1);
		point b = point(x2, y2);
		point c = point(x3, y3);
		point p = point(xp, yp);
		cout << cross(p, a, b, a) << " " << cross(p, b, c, b) << " " << cross(p, c, a, c) << endl;
		if ((pn(cross(p, a, b, a)) && pn(cross(p, b, c, b)) && pn(cross(p, c, a, c))) ||
			(pn(cross(p, a, b, a) * (-1)) && pn(cross(p, b, c, b) * (-1)) && pn(cross(p, c, a, c) * (-1)))){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

	}
	return 0;
}

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

int check(double x1, double y1, double x2, double y2, double x3, double y3){
	double ab = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	double bc = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
	double ca = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
	double s = (ab + bc + ca) * 0.5;
	double S = sqrt(s * (s - ab) * (s - bc) * (s - ca));
	return S;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
	
	double abc = check(x1, y1, x2, y2, x3, y3);
	double abp = check(x1, y1, x2, y2, xp, yp);
	double bcp = check(x2, y2, x3, y3, xp, yp);
	double cap = check(x3, y3, x1, y1, xp, yp);
	
	double var = abc - (abp + bcp + cap);
	if(var <= 0.001 && var >= -0.001){
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	}
	
	return 0;
}