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

int main() {
  double x1,y1,x2,y2,x3,y3,xp,yp;
  double a[2],b[2];
  double A,B;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    a[0] = x2 - x1;
    a[1] = y2- y1;
    b[0] = x3 - x1;
    b[1] = y3 - y1;
    if(a[0] * b[1] -b[0] * a[1] != 0) {
    A = ( xp * b[1] - b[0] * yp) / (a[0] * b[1] - b[0] * a[1]);
    B = (a[0] * yp - xp * a[1]) / (a[0] * b[1] - b[0] * a[1]);
    if ((A+B < 1) && (A > 0) && (B > 0)) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
    }
  }
}

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

typedef complex<double> cd;

#define X real()
#define Y imag()

double dot(cd a,cd b){
    return (a*conj(b)).X;
}

double cross(cd a,cd b){
    return -((a*conj(b)).Y);
}

int main(){
    double x,y;
    vector<cd> v,vec;

    while(cin>>x>>y){
        v.push_back(cd(x,y));
        for(int i=1;i<3;i++){
            cin>>x>>y;
            v.push_back(cd(x,y));
        }

        v.push_back(v[0]);

        for(int i=0;i<3;i++){
            vec.push_back(v[i+1]-v[i]);
        }

        cin>>x>>y;

        int all_p=1,all_n=1;
        for(int i=0;i<3;i++){
            int crs=cross(vec[i],cd(x,y)-v[i]);
            all_p &= crs>0;
            all_n &= crs<0;
        }

        if(all_p || all_n){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}

C++: #include<iostream>

class vec{
  double x,y;
public:
  void set(double a,double b){
    x = a;
    y = b;
  }
  double getx(){return x;}
  double gety(){return y;}
};

double gaiseki(vec v1,vec v2){
  return v1.getx()*v2.gety() - v1.gety()*v2.getx();
}

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  vec v1,v2,v3;
  int flag = 0;

  while(std::cin >>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
    v1.set(x2-x1,y2-y1);
    v2.set(x3-x1,y3-y1);
    v3.set(xp-x1,yp-y1);
    flag = 0;
    if(gaiseki(v3,v1)*gaiseki(v3,v2) < 0){
      v1.set(x1-x2,y1-y2);
      v2.set(x3-x2,y3-y2);
      v3.set(xp-x2,yp-y2);
      if(gaiseki(v3,v1)*gaiseki(v3,v2) < 0){
        v1.set(x1-x3,y1-y3);
        v2.set(x2-x3,y2-y3);
        v3.set(xp-x3,yp-y3);
        if(gaiseki(v3,v1)*gaiseki(v3,v2) < 0){
          flag = 1;
        }
      }
    }
    if(flag){
      std::cout << "YES" << std::endl;
    }else{
      std::cout << "NO" << std::endl;
    }
  }
}

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

class point{ // as necessary
	private:
		static const double EPS=1e-5;
	public:
		static const int COUNTER_CLOCKWISE=1;
		static const int CLOCKWISE=-1;
		static const int ONLINE_BACK=2;
		static const int ONLINE_FRONT=-2;
		static const int ON_SEGMENT=0;

		double x;
		double y;
		point(double x=0,double y=0):x(x),y(y){}

		point operator+(point p){return point(x+p.x,y+p.y);}
		point operator-(point p){return point(x-p.x,y-p.y);}
		point operator*(const double a){return point(x*a,y*a);}
		point operator/(const double a){return point(x/a,y/a);}

		static double dot(const point &p1,const point &p2){
			return p1.x*p2.x+p1.y*p2.y;
		}

		double norm(){
			return x*x+y*y;
		}

		double abs(){
			return sqrt(norm());
		}

		static double cross(point p1,point p2){
			return p1.x*p2.y-p1.y*p2.x;
		}

		static int ccw(point p0,point p1,point p2){
			point a=p1-p0; // ??????p0p1
			point b=p2-p0; // ??????p0p2
			if(cross(a,b)>EPS) return COUNTER_CLOCKWISE; // a????????????b??????????¨?
			if(cross(a,b)<-EPS) return CLOCKWISE; // a????????????b???????¨?
			if(dot(a,b)<-EPS) return ONLINE_BACK; // p2-p0-p1???????????¢???
			if(a.norm(),b.norm()) return ONLINE_FRONT; // p0-p1-p2???????????¢???
			return ON_SEGMENT; // p0-p2-p1???????????¢???
		}
};

int main(void){
	double x,y;
	while(cin>>x>>y){
		int rcw=0;
		int cw=0;
		point a(x,y);
		cin>>x>>y;
		point b(x,y);
		cin>>x>>y;
		point c(x,y);
		cin>>x>>y;
		point d(x,y);
		switch(point::ccw(d,a,b)){
			case point::COUNTER_CLOCKWISE:rcw++;break;
			case point::CLOCKWISE:cw++;break;
		}
		switch(point::ccw(d,b,c)){
			case point::COUNTER_CLOCKWISE:rcw++;break;
			case point::CLOCKWISE:cw++;break;
		}
		switch(point::ccw(d,c,a)){
			case point::COUNTER_CLOCKWISE:rcw++;break;
			case point::CLOCKWISE:cw++;break;
		}
		if(rcw==1&&cw==2)cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
using namespace std;

double getScale(double a, double b, double c, double d,double e,double f) {
	double x1, y1, x2, y2;

	x1 = c - a;
	x2 = e - a;
	y1 = d - b;
	y2 = f - b;

	double result = x1 * y2 - x2 * y1;
	if (result < 0)result *= -1;

	return 0.5 * result;

}

int main() {

	double x[4];
	double y[4];

	double value1, value2;

	while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]) {
		value1 = getScale(x[0], y[0], x[1], y[1], x[2], y[2]);
		value2 = getScale(x[3], y[3], x[1], y[1], x[2], y[2]) + getScale(x[0], y[0], x[3], y[3], x[2], y[2]) + getScale(x[0], y[0], x[1], y[1], x[3], y[3]);
		
		if (value2 > value1)printf("NO");
		else printf("YES");
		printf("\n");
	}

	//system("pause");
	return 0;
}

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

typedef struct P {
	double x, y;
} P;
typedef struct vec {
	double x, y;
	vec() {}
	vec(P p1, P p2) {
		x = p2.x - p1.x;
		y = p2.y - p1.y;
	}
} vec;
inline double cross(vec v1, vec v2) {
	return v1.x*v2.y - v1.y*v2.x;
}

P p[4];
vec v[3];
double a, b;
int ar[3][4] = {
	{0,1,2,3 },{1,2,0,3},{2,0,1,3}
};

int main(){
	bool f;
	while (true) {
		for (int i = 0; i < 4; i++) {
			if (scanf("%lf%lf", &p[i].x, &p[i].y) == EOF) {
				return 0;
			}
		}
		f = true;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				v[j] = vec(p[ar[i][0]], p[ar[i][j + 1]]);
			}
			a = cross(v[0], v[1]);
			b = cross(v[0], v[2]);
			if (a*b < 0) {
				printf("NO\n");
				f = false;
				break;
			}
		}
		if (f) {
			printf("YES\n");
		}
	}

	return 0;
}

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

bool point(double x1, double y1, double x2, double y2, double x3, double y3, double px, double py){
	double a1 = (x2 != x1) ? (y2 - y1) / (x2 - x1) : 100000 * (((y2 - y1) < 0) * 2 - 1 );
	double a2 = (x3 != x1) ? (y3 - y1) / (x3 - x1) : 100000 * (((y3 - y1) < 0) * 2 - 1 );
	double ap = (px != x1) ? (py - y1) / (px - x1) : 100000 * (((py - y1) < 0) * 2 - 1 );
	
	if ((a1 >= ap && a2 <= ap) || (a1 <= ap && a2 >= ap))
		return true;
	else
		return false;
}

int main(){
	double x1, y1, x2, y2, x3, y3, px, py;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py)
		printf((point(x1, y1, x2, y2, x3, y3, px, py) && point(x2, y2, x3, y3, x1, y1, px, py)) ? "YES" : "NO");

	return 0;
}