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 <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;

int main(){
	double x1, x2, x3, y1, y2, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double xa = x2 - x1;
		double ya = y2 - y1;
		double xb = x3 - x1;
		double yb = y3 - y1;
		double x = xp - x1;
		double y = yp - y1;
		double div = xa * yb - xb * ya;
		double a = (yb * x - xb * y) / div;
		double b = (-ya * x + xa * y) / div;
		if (a >= 0 && b >= 0 && a + b <= 1) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdlib>
#include<complex>
using namespace std;
typedef complex<double> Po;

double cross(Po a,Po b){return a.real()*b.imag() - a.imag()*b.real();}

double area(Po a,Po b, Po c){return abs(cross(b-a,c-a))/2;}

bool inter(Po a, Po b,Po c,Po x){
return (fabs(area(a,b,x)+area(b,c,x)+area(c,a,x)-area(a,b,c))<1e-10);
}

int main(){
Po p[4];
while(cin>>p[0].real() >> p[0].imag()){
for(int i=1;i<4;i++)cin >> p[i].real() >> p[i].imag();
if(inter(p[0],p[1],p[2],p[3]))cout << "YES\n";
else cout << "NO\n";
}
}

C++: #include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

struct point{
    double x,y;
    point(double _x , double _y){
        x = _x , y = _y;
    }
};

bool insidePoly( point p,vector<point>P  ) {
	bool inside = false;
	int n = P.size();
	for( int i = 0, j = n - 1; i < n; j = i++ )
		if( (( P[i].x < p.x ) ^ ( P[j].x < p.x )) &&
        (P[i].y - P[j].y) * fabs(p.x - P[j].x) < (p.y - P[j].y) * abs(P[i].x - P[j].x) )
			inside = !inside;
	return inside;
}

int main()
{

     double x,y;
    while(cin>>x>>y)
    {
        vector<point>P;
        P.push_back(point(x,y));

        for( int i = 0 ; i < 2 ; i++ ){
                scanf("%lf %lf",&x,&y);
                P.push_back(point(x,y));
        }
        scanf("%lf %lf",&x,&y);

        bool f = insidePoly(point(x,y),P);

        if(f)puts("YES"); else puts("NO");

    }
}

C++: #include<cstdio>
int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) == 8)
	{
		double a1, b1, c1, a2, b2, c2, a3, b3, c3;
		if(x1 == x2)
		{
			a1 = 1.0;
			b1 = 0.0;
			c1 = x1;
		}
		else if(y1 == y2)
		{
			a1 = 0.0;
			b1 = 1.0;
			c1 = y1;
		}
		else
		{
			b1 = 1.0;
			a1 = -1.0 * (y2 - y1) / (x2 - x1);
			c1 = a1 * x1 + b1 * y1;
		}
		if((a1 * x3 + b1 * y3 - c1) * (a1 * xp + b1 * yp - c1) <= 0)
		{
			printf("NO\n");
			continue;
		}
		if(x1 == x3)
		{
			a2 = 1.0;
			b2 = 0.0;
			c2 = x1;
		}
		else if(y1 == y3)
		{
			a2 = 0.0;
			b2 = 1.0;
			c2 = y1;
		}
		else
		{
			b2 = 1.0;
			a2 = -1.0 * (y3 - y1) / (x3 - x1);
			c2 = a1 * x1 + b1 * y1;
		}
		if((a2 * x2 + b2 * y2 - c2) * (a2 * xp + b2 * yp - c2) <= 0)
		{
			printf("NO\n");
			continue;
		}
		if(x2 == x3)
		{
			a3 = 1.0;
			b3 = 0.0;
			c3 = x2;
		}
		else if(y2 == y3)
		{
			a3 = 0.0;
			b3 = 1.0;
			c3 = y2;
		}
		else
		{
			b3 = 1.0;
			a3 = -1.0 * (y3 - y2) / (x3 - x2);
			c3 = a2 * x2 + b2 * y2;
		}
		if((a3 * x1 + b3 * y1 - c3) * (a3 * xp + b3 * yp - c3) <= 0)
		{
			printf("NO\n");
			continue;
		}
		printf("YES\n");
	}
	return 0;
}

C++: #include <iostream>

#define SIZE 3

using namespace std;

int main() {
	float x[SIZE], y[SIZE], xp, yp, a, b, c;

	while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp) {
		a = (xp - x[0]) * (yp - y[1]) - (yp - y[0]) * (xp - x[1]);
		b = (xp - x[1]) * (yp - y[2]) - (yp - y[1]) * (xp - x[2]);
		c = (xp - x[2]) * (yp - y[0]) - (yp - y[2]) * (xp - x[0]);

		if ((a > 0 && b > 0 && c > 0) || (a < 0 && b < 0 && c < 0)) {
			cout << "YES";
		}
		else {
			cout << "NO";
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> point;
double cross(point a,point b){
    return imag(conj(a)*b);
}
double dot(point a,point b){
    return real(conj(a)*b);
}
int ccw(point a,point b,point c){
    b -= a; c-= a;
    if(cross(b,c) > 0) return 1;
    if(cross(b,c) < 0) return -1;
    if(dot(b,c) < 0) return 2;
    if(norm(b) < norm(c) ) return -2;
    return 0;
}

int main(){
    while(cin){
        vector<point> P;
        for(int i=0;i<3;i++){
            double y,x;
            if(not (cin >> x >> y)){
                goto end;
            }
            P.push_back(point(x,y));
        }
        point inner;
        cin >> inner.real() >> inner.imag();
        if(ccw(P[0],P[1],inner) == 1 and
                ccw(P[1],P[2],inner) == 1  and
                ccw(P[2],P[0],inner) == 1){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
end:;
    return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;

// ??????: a.x*b.x
double dot_product(xy_t a, xy_t b) { 
  return (conj(a)*b).real(); 
}
// ??????: a.x*b.y - b.x*a.y
// ????§???¢????¬????????????¢????????????
double cross_product(xy_t a, xy_t b) { 
  return (conj(a)*b).imag(); 
}
// ?????±: ????????¨ p ??????????????´?????? b ????????±
xy_t projection(xy_t p, xy_t b) { 
  return b*dot_product(p,b)/norm(b); 
}

double x[4], y[4];
int main() {
while (true) {
  for (int i=0; i<4; ++i) cin >> x[i] >> y[i];
  if (!cin) break;
  xy_t a(x[0],y[0]), b(x[1],y[1]), c(x[2],y[2]), p(x[3],y[3]);
  // pab ????¬????????????¢?????? 2 ??????,cross product(a-p,b-p)
  // pbc ????¬????????????¢?????? 2 ??????,cross product(b-p,c-p)
  // pca ????¬????????????¢?????? 2 ??????,cross product(c-p,a-p)
  int aaa = 0;
  if (cross_product(a-p,b-p) > 0) aaa++;
  if (cross_product(b-p,c-p) > 0) aaa++;
  if (cross_product(c-p,a-p) > 0) aaa++;
  bool ok = false;
  if (aaa == 3 || aaa == 0) ok = true;
  cout << (ok ? "YES" : "NO") <<  endl;
  }
}