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

struct Pos{
	double x,y;
};

Pos VSub(Pos pos1,Pos pos2){
	pos1.x -= pos2.x;
	pos1.y -= pos2.y;
	return pos1;
}

Pos Rotate(Pos v,double ang){
	double t;
	t = v.y;
	v.y = v.y*cos(ang)+v.x*sin(ang);
	v.x = v.x*cos(ang)-t*sin(ang);
	return v;
}
int main(){
	Pos point[4];	//point[3]:ten
	char *c[200];
	int i,cor = 0;
	while(cin >> point[0].x){
		cin >> point[0].y;
		for(i = 1;i < 4;i++){
			cin >> point[i].x >> point[i].y;
		}
		Pos v[6];
		double at[6];
		for(i = 0;i < 3;i++){
			v[i] = VSub(point[(i+1)%3],point[i]);
			v[i+3] = VSub(point[3],point[i]);
		}
		for(i = 0;i < 3;i++){
			at[i] = atan2(v[i].y,v[i].x);
			v[i+3] = Rotate(v[i+3],-at[i]);
			at[i+3] = atan2(v[i+3].y,v[i+3].x);
		}
		if(at[3] * at[4] > 0 && at[4]*at[5] > 0)
			c[cor] = "YES";
		else
			c[cor] = "NO";
		cor++;
	}
	for(i = 0;i < cor;i++)
		cout << c[i] << endl;
}

C++: #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8, pi = acos(-1.0);
bool eq(ld a, ld b){return (abs(b-a)<eps);}
ld dot(Point a, Point b){return real(conj(a)*b);}
ld cross(Point a, Point b){ return imag(conj(a)*b);}
int ccw(Point a, Point b, Point c){
  b-=a;c-=a;
  if(cross(b,c)>eps) return 1;//countor_crockwise
  if(cross(b,c)<-eps) return -1;//crockwise
  if(dot(b,c)<0) return 2;//c,a,b
  if(norm(b)<norm(c)) return -2;//a,b,c
  return 0;//a,c,b
}

int main(){
  Point p[4];
  ld x,y;
  while(cin>>x>>y){
    p[0]=Point(x,y);
    REP(i,3){
      cin>>x>>y;
      p[i+1]=Point(x,y);
    }
    int a=ccw(p[0],p[1],p[3]);
    int b=ccw(p[1],p[2],p[3]);
    int c=ccw(p[2],p[0],p[3]);
    if((a==1&&b==1&&c==1)||(a==-1&&b==-1&&c==-1))
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

bool line(double x1, double y1, double x2, double y2, double xp, double yp){
    return (yp-y1)*(x2-x1) - (y2-y1)*(xp-x1) > 0;
}

int main(){
    vector<double> p(6);
    double xp, yp;
    while(cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> p[5] >> xp >> yp){
        bool yes = true;
        for(int i = 0; i < 3; i++){
            yes &= !(line(p[0],p[1],p[2],p[3],p[4],p[5]) ^ line(p[0],p[1],p[2],p[3],xp,yp));
            rotate(p.begin(), p.begin()+2, p.end());
        }
        cout << (yes ? "YES" : "NO") << endl;
    }
}

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

int main(){

	typedef struct{
		double x, y;
	}_point;

	double a, b, s, t, r_p3, r_p2, eps;
	_point p1, p2, p3, p;
	
	eps = 10^(-3);
 
  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p.x >> p.y){
		p2.x -= p1.x;
		p2.y -= p1.y;
		p3.x -= p1.x;
		p3.y -= p1.y;
		p.x -= p1.x;
		p.y -= p1.y;
		r_p2 = sqrt(p2.x * p2.x + p2.y * p2.y);
		r_p3 = sqrt(p3.x * p3.x + p3.y * p3.y);
		if(p2.x > eps){
			s = p.y - p.x * p2.y / p2.x;
			t = p3.y - p3.x * p2.y / p2.x;
			a = (s / t);
			b = (p.x - a * p3.x) / p2.x;
		}
		else {
			a = p.x / p3.x;
			b = (p.y - a * p3.y) / p2.y;
		}

		if(a > 0 && b > 0 && a + b < 1) cout << "YES" << endl;
		else cout << "NO" << endl;
  }

  return 0;
}

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

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

double cross(const P &a, const P &b) { return imag(conj(a)*b); }
double dot(const P &a, const P &b) { return real(conj(a)*b); }

P p[4];
void solve() {
    p[0] -= p[3];
    p[1] -= p[3];
    p[2] -= p[3];
    int u = 0;
    for (int i = 0; i < 3; i++) {
        P p1 = p[i], p2 = p[(i+1)%3];
        if (p1.imag() > p2.imag()) swap(p1, p2);
        if (p1.imag() > 0 || p2.imag() <= 0) continue;
        if (cross(p1, p2) < 0) continue;
        u++;
    }
    if (u == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


int main() {
    while (true) {
        for (int i = 0; i < 4; i++) {
            R x, y;
            cin >> x >> y;
            p[i] = P(x, y);
        }
        if (cin.eof()) break;
        solve();
    }
    return 0;
}