Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

C++: #include <iostream>
#include <cmath>
#define EPS 10e-10
using namespace std;
double heron(double a,double b,double c){
  double s = (a+b+c)/2;
  return sqrt(s*(s - a)*(s - b)*(s - c));
}

int main(){
  double x[4],y[4];
  while(cin >> x[0]){
    cin >>y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    double A,B,C;
    A = sqrt(pow(x[2] - x[1],2)+pow(y[2] - y[1],2));
    B = sqrt(pow(x[2] - x[0],2)+pow(y[2] - y[0],2));
    C = sqrt(pow(x[1] - x[0],2)+pow(y[1] - y[0],2));

    double S1 = heron(A,B,C);

    double XA,XB,XC;
    XA = sqrt(pow(x[3] - x[0],2)+pow(y[3] - y[0],2));
    XB = sqrt(pow(x[3] - x[1],2)+pow(y[3] - y[1],2));
    XC = sqrt(pow(x[3] - x[2],2)+pow(y[3] - y[2],2));

    double S2 = heron(XA,XB,C) + heron(XA,XC,B) + heron(XB,XC,A);
    if(fabs(S1-S2) < EPS)cout <<"YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double vx1, vy1, vx2, vy2, vxp, vyp;
	double s, t;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		vx1 = x2 - x1;
		vy1 = y2 - y1;
		vx2 = x3 - x1;
		vy2 = y3 - y1;
		vxp = xp - x1;
		vyp = yp - y1;
		s = (vyp*vx2 - vxp*vy2) / (vy1*vx2 - vx1*vy2);
		if (vx2) {
			t = (vxp - vx1*s) / vx2;
		} else {
			t = (vyp - vy1*s) / vy2;
		}

		if (s>0.0 && t>0.0 && s + t<1.0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>
 
using namespace std;
 
typedef struct Point {
    double x;
    double y;
} POINT;
 
double area(Point l, Point m, Point n);
 
int main() {
    Point a, b, c, p;
    while (cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y) {
        double diff = area(a, b, c) - (area(a, b, p) + area(b, c, p) + area(c, a, p));
        if (fabs(diff) < 0.001) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        } 
    }
}
 
double area(Point l, Point m, Point n) {
    return fabs( (m.x - l.x) * (n.y - l.y)
            - (m.y - l.y) * (n.x - l.x)) * 0.5;
}

C++: #include <cstdio>
#include <algorithm>
#include <complex>
using namespace std;

int main() {
  for(int tci = 0; ; tci++) {
    complex<double> ps[3];
    complex<double> pp;
    int rr = scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
        &ps[0].real(), &ps[0].imag(),
        &ps[1].real(), &ps[1].imag(),
        &ps[2].real(), &ps[2].imag(),
        &pp.real(), &pp.imag());
    if(rr<8) break;
    bool ok = true;
    for(int i = 0; i < 3; i++) {
      double det1 = imag( (ps[(i+1)%3]-ps[i]) * conj(pp-ps[i]) );
      double det2 = imag( (ps[(i+2)%3]-ps[i]) * conj(pp-ps[i]) );
      if(det1 * det2 > 1e-9) {
        ok = false;
      }
    }
    printf("%s\n", ok ? "YES" : "NO");
  }
  return 0;
}

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


int main()
{
	int i,count1,count2,ind1,ind2;
	float x[3],y[3],xp,yp;
	while( cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp ) {
		count1 = 0;
		count2 = 0;
		for( i = 0; i < 3; i++ ) {
			ind1 = i;
			ind2 = ( (i+1) % 3);
			if( ( ( xp -x[ind1] ) *( yp-y[ind2]) - (xp-x[ind2])*(yp-y[ind1]) ) < 0 ){
				count1 ++;
			}
			else if( ( ( xp -x[ind1] ) *( yp-y[ind2]) - (xp-x[ind2])*(yp-y[ind1]) ) > 0 ){
				count2 ++;
			}
		}
		if( count1 == 3 || count2 == 3 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}


	return 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;
	bool flg = false;
	REP(i,1e6){
	    s = ((double)i/1e6);
	    t = (double)1 - s;
	    double x1 = s * (x[2] - x[0]) + t * ( x[1] - x[0]);
	    double y1 = s * (y[2] - y[0]) + t * ( y[1] - y[0]);
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    double dotpro = (  (  (x1 * x2 + y1 * y2 )*(x1 * x2 + y1 * y2 ) )  /( (x1*x1 + y1*y1)*(x2*x2 + y2*y2))); 
	    if(  abs(1 - sqrt(dotpro))  <= 0.00001  ){
//		cout << dotpro << endl;
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}

C++: #include <iostream>
#define formula(i,X,Y) ((x[(i+1)%3]-x[(i+2)%3])*(Y-y[(i+1)%3])-(y[(i+1)%3]-y[(i+2)%3])*(X-x[(i+1)%3]))
#define check(i) formula(i,xp,yp)*formula(i,x[i],y[i])

using namespace std;

int main(void){
	float x[3],y[3],xp,yp;

	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp)
		cout << (check(0)>0&&check(1)>0&&check(2)>0 ? "YES" : "NO") << endl;

	return 0;
}

C++: #include <stdio.h>
double root(double a1, double b1, double a2, double b2, double a3, double b3) {double S=a1*b2+a2*b3+a3*b1-b1*a2-b2*a3-b3*a1;if (S<0) return -S; else return S;}
int main() {
    double x1,x2,x3,xp,y1,y2,y3,yp;while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)) {
    double s=root(x1,y1,x2,y2,x3,y3),s1=root(x1,y1,x2,y2,xp,yp),s2=root(x1,y1,xp,yp,x3,y3),s3=root(xp,yp,x2,y2,x3,y3);
    if (s==s1+s2+s3) puts("YES"); else puts("NO");} return 0;}