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++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0012

#include <iostream>
using namespace std;

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;

	while (cin >> x1 >> y1
		       >> x2 >> y2 
		       >> x3 >> y3
		       >> xp >> yp) {

		double l1_x = (y2 - y3);
		double l1_y = -(x2 - x3);
		double l1_c = -(y2 - y3)*x3 + y3;
		
		double l2_x = (y1 - y3);
		double l2_y = -(x1 - x3);
		double l2_c = -(y1 - y3)*x3 + y3;

		double l3_x = (y1 - y2);
		double l3_y = -(x1 - x2);
		double l3_c = -(y1 - y2)*x2 + y2;

		if ((l1_x * xp + l1_y * yp + l1_c)*l1_c >= 0 &&
			(l2_x * xp + l2_y * yp + l2_c)*l2_c >= 0 &&
			(l3_x * xp + l3_y * yp + l3_c)*l3_c >= 0)
			cout << "YES" << endl;
		else
			cout << "NO" << 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) or 
           (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 <cmath>
using namespace std;

struct Vec2d{
  double x,y;
};

double cross(Vec2d &A, Vec2d &B){
  return A.x*B.y - A.y*B.x;
}

int main(void){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
	  Vec2d AB,AP,BC,BP,CA,CP;
	  AB.x = x2-x1; AB.y = y2-y1;
	  BC.x = x3-x2; BC.y = y3-y2;
	  CA.x = x1-x3; CA.y = y1-y3;
	  AP.x = xp-x1; AP.y = yp-y1;
	  BP.x = xp-x2; BP.y = yp-y2;
	  CP.x = xp-x3; CP.y = yp-y3;
	  if(cross(AB,AP)>0.0 && cross(BC,BP)>0.0 && cross(CA,CP)>0.0)
	  	cout<<"YES"<<endl;
	  else if(cross(AB,AP)<0.0 && cross(BC,BP)<0.0 && cross(CA,CP)<0.0){
	  	cout<<"YES"<<endl;
	  }else
	  	cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

typedef struct _Point {
	double x;
	double y;
} Point;

typedef struct _Line {
	Point a;
	Point b;
} Line;

typedef struct _Triangle {
	Point a;
	Point b;
	Point c;
} Triangle;

int side(Point p, Line l) {
	int n = p.x * (l.a.y - l.b.y) + l.a.x * (l.b.y - p.y) + l.b.x * (p.y - l.a.y);
	if (n > 0) return 1;
	else if (n < 0) return -1;
	else return 0;
}

bool pointInaTriangle(Point p, Triangle t) {
	Line ab, bc, ca;
	ab.a = t.a; ab.b = t.b;
	bc.a = t.b; bc.b = t.c;
	ca.a = t.c; ca.b = t.a;
	int pab = side(p, ab);
	int pbc = side(p, bc);
	int pca = side(p, ca);
	if (0 < pab && 0 < pbc && 0 < pca)
		return true;
	return false;
}

int main() {
	Triangle t;
	Point p;
	while (cin >> t.a.x >> t.a.y >> t.b.x >> t.b.y >> t.c.x >> t.c.y >> p.x >> p.y) {
		if (pointInaTriangle(p, t) == true)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <complex>
#define rep(i,n) for(int i=0; i<(n); i++)
#define EPS 1e-10
using namespace std;

typedef complex<double> cd;

double s(cd a, cd b){
  return double(a.real()*b.imag()-a.imag()*b.imag());
}

int main(){
  cd a[4];

  for(;;){
    rep(i,4){
      double x,y;
      if(!~scanf(" %lf %lf", &x,&y))
        return 0;
      a[i]=cd(x,y);
    }
    
    if((s(a[0]-a[3], a[1]-a[3]) > 0 && 
        s(a[1]-a[3], a[2]-a[3]) > 0 &&
        s(a[2]-a[3], a[1]-a[3]) > 0 ) ||
       (s(a[0]-a[3], a[1]-a[3]) < 0 && 
        s(a[1]-a[3], a[2]-a[3]) < 0 &&
        s(a[2]-a[3], a[1]-a[3]) < 0 ))
      printf("IN\n");
    else
      printf("OUT\n");
  }
  
  return 0;
}

C++: //#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	double x[4],y[4],dx[3],dy[3],dpx[3],dpy[3];
	double th[3], pth[3];
	int check = 0;
	bool ans = true;


	while (	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){
		if (x[1] == 0 && y[1] == 0){
			swap(x[0], x[1]);
			swap(y[0], y[1]);
		}
		if (x[2] == 0 && y[2] == 0){
			swap(x[0], x[2]);
			swap(y[0], y[2]);
		}
		if (atan2(y[1]-y[0], x[1]-x[0]) > atan2(y[2]-y[0], x[2]-x[0])){
			swap(x[1], x[2]);
			swap(y[1], y[2]);
		}

		for (int i = 0; i < 3; i++){
			dx[i] = x[(i + 1) % 3] - x[i];
			dy[i] = y[(i + 1) % 3] - y[i];
			dpx[i] = x[3] - x[i];
			dpy[i] = y[3] - y[i];
			th[i] = atan2(dy[i], dx[i]);
			pth[i] = atan2(dpy[i], dpx[i]);
		}

		for (int i = 0; i < 3; i++){
			if (sin(th[i] - pth[i])>0){
				ans = false;
				break;
			}
		}
		cout << (ans ? "YES" : "NO" )<< endl;
	}
}