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<complex>
#include<iostream>
using namespace std;

typedef complex<double> Point;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( (a).real() , (b).real() ) && EQ( (a).imag(), (b).imag() ) )

// àÏ : aEb
double dot(Point a,Point b) {
  return (a.real()*b.real() + a.imag()*b.imag());
}

//OÏ a~b
double cross(Point a,Point b) {
  return (a.real()*b.imag() - a.imag()*b.real());
}


// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð·»è
int is_intersected_ls(Point a1, Point a2, Point b1, Point b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int main(){
  double x,y;

  while(cin>>x>>y){
  Point p1(x,y);

  cin>>x>>y;
  Point p2(x,y);

  cin>>x>>y;
  Point p3(x,y);

  cin>>x>>y;
  Point p(x,y);

  Point s(200,252.3);

  bool flag1,flag2,flag3;

  flag1= is_intersected_ls(p,s,p1,p2);
  flag2 = is_intersected_ls(p,s,p2,p3);
  flag3 = is_intersected_ls(p,s,p3,p1);

  if((flag1^flag2)^flag3) {
    cout<<"YES"<<endl;
    continue;
  }

  cout<<"NO"<<endl;

  }
}

C++: #include<bits/stdc++.h>
#define EPS (1e-10)
#define equals(a,b)(fabs((a)-(b))<EPS)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

struct Point {
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}
	Point operator*(double a) { return Point(a*x, a*y); }
	Point operator-(Point p) { return Point(x - p.x, y - p.y); }
};
struct Segment {
	Point p1, p2;
};
double cross(Point a, Point b) {
	return a.x*b.y - a.y*b.x;
}
double dot(Point a, Point b) {
	return a.x*b.x + a.y*b.y;
}
bool isPrallel(Segment s1, Segment s2) {
	return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}
bool isOrthogonal(Segment s1, Segment s2) {
	return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}
typedef vector<Point>Polygon;
int contains(Polygon g, Point p) {
	int n = g.size();
	bool x = false;
	rep(i, n) {
		Point a = g[i] - p, b = g[(i + 1) % n] - p;
		if (abs(cross(a, b)) < EPS&&dot(a, b) < EPS)return 1;
		if (a.y > b.y)swap(a, b);
		if (a.y < EPS&&EPS<b.y&&cross(a, b)>EPS)x = !x;
	}
	return x ? 2 : 0;
}
int main() {
	while (1) {
		Polygon g;
		double x, y;
		rep(i, 3) {
			if (!(cin >> x >> y))break;
			g.push_back(Point(x, y));
		}
		cin >> x >> y;
		if (contains(g, Point( x,y )) == 2)puts("YES");
		else puts("NO");
	}
}

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

struct Vector{
	double x;
	double y;
};

Vector sub_vector(Vector &a , Vector &b){
	Vector ret;
	ret.x=a.x-b.x;
	ret.y=a.y-b.y;
	return ret;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp; //p
		v[3].y=yp;
		Vector ab = sub_vector(v[1] , v[0]);
		Vector bp = sub_vector(v[3] , v[1]);
		Vector bc = sub_vector(v[2] , v[1]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ca = sub_vector(v[0] , v[2]);
		Vector ap = sub_vector(v[3] , v[0]);
		double c1 = ab.x * ap.y - ab.y * ap.x; //??????
		double c2 = bc.x * bp.y - bc.y * bp.x;
		double c3 = ca.x * cp.y - ca.y * cp.x;
		if((c1<0 && c2<0 && c3 <0)||(c1>0 && c2>0 && c3>0)) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}

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

bool judge(double x1, double x2, double x3, double y1, double y2, double y3, double xp, double yp)
{
    if (((x2 - x1) * (yp - y2)) - ((y2 - y1) * (xp - x2)) > 0)
    {
        if (((x3 - x2) * (yp - y3)) - ((y3 - y2) * (xp - x3)) > 0)
        {
            if (((x1 - x3) * (yp - y1)) - ((y1 - y3) * (xp - x1)) > 0)
            {
                return true;
            }
        }
    }
    if (((x2 - x1) * (yp - y2)) - ((y2 - y1) * (xp - x2)) < 0)
    {
        if (((x3 - x2) * (yp - y3)) - ((y3 - y2) * (xp - x3)) < 0)
        {
            if (((x1 - x3) * (yp - y1)) - ((y1 - y3) * (xp - x1)) < 0)
            {
                return true;
            }
        }
    }
    return false;
}

int main(void){
    double x1, x2, x3, y1, y2, y3;
    double xp, yp;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
    bool d;
    d = judge(x1, x2, x3, y1, y2, y3, xp, yp);
    if(d){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
double x[4],y[4],r[3];
void che(int a,int b){
	if(x[a]>x[b]){
		swap(x[a],x[b]);
		swap(y[a],y[b]);
	}
}
int main(){
	int m=0;
	while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3]){
		che(0,1);
		che(1,2);
		che(0,1);
		if(y[0]<=y[3] && y[3]<=y[1]){
			r[0]=x[0]+(x[2]-x[0])*(y[3]-y[0])/(y[2]-y[0]);
			r[1]=x[0]+(x[1]-x[0])*(y[3]-y[0])/(y[1]-y[0]);
			if(r[0]>r[1])swap(r[0],r[1]);
		}else if(y[1]<=y[3] && y[3]<=y[2]){
			r[0]=x[2]+(x[0]-x[2])*(y[2]-y[3])/(y[2]-y[0]);
			r[1]=x[2]+(x[1]-x[2])*(y[2]-y[3])/(y[2]-y[1]);
			if(r[0]>r[1])swap(r[0],r[1]);
		}else{
			cout<<"NO"<<endl;
			continue;
		}
		if(r[0]<=x[3] && x[3]<=r[1]){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}