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;

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) : 10000000 * (((y2 - y1) < 0) * 2 - 1 );
	double a2 = (x3 != x1) ? (y3 - y1) / (x3 - x1) : 10000000 * (((y3 - y1) < 0) * 2 - 1 );
	double ap = (px != x1) ? (py - y1) / (px - x1) : 10000000 * (((py - y1) < 0) * 2 - 1 );
	
	if (a1>0 && a2 > 0 && ap > 0 || a1<0 && a2<0 && ap<0){
		if (a1>ap && a2 < ap || a1<ap && a2>ap)return true;
		return false;
	}
	else{
		if (1000000>ap && ap>a1 && -1000000 < ap && ap < a2 || 1000000 > ap && ap > a2 && -1000000 < ap && ap < a1)return true;
		return false;
	}
}

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

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

	return 0;
}

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

int main(){
	double x[3],y[3],xp,yp;
	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp
		bool ans=true;
		for(int i=0;i<3;i++){
			double gaiseki;
			int k = (i+1)%3;
			double vx,vy,vpx,vpy;
			vx = x[k]-x[i];
			vy = y[k]-y[i];
			vpx = xp-x[i];
			vpy = yp-y[i];
			gaiseki = vx*vpy-vy*vpx;
			if(gaiseki<=0) ans = false;
		}
		if(ans){
			cout << "YES" << endl;
		}else{
				cout << "NO" << endl;
		}

	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
#define EPS 1e-9

double get_distance( double x1, double y1, double x2, double y2 )
{
	return sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) );
}

double get_sum( double x1, double y1, double x2, double y2, double x3, double y3 )
{
	double a = get_distance( x1, y1, x2, y2 );
	double b = get_distance( x2, y2, x3, y3 );
	double c = get_distance( x3, y3, x1, y1 );
	double s = ( a + b + c ) / 2;
	return sqrt( s * ( s - a ) * ( s - b ) * ( s - c ) );
}

int main( void )
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while ( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp )
	{
		double s = get_sum( x1, y1, x2, y2, x3, y3 );
		double s1 = get_sum( x1, y1, xp, yp, x2, y2 );
		double s2 = get_sum( x2, y2, xp, yp, x3, y3 );
		double s3 = get_sum( x3, y3, xp, yp, x1, y1 );

		if ( fabs( s - ( s1 + s2 + s3 ) ) <= EPS ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: import java.util.*;
import java.io.*;
import java.math.*;

public class Main {
    public static void main(String args[])throws Exception{
        Scanner cin= new Scanner(System.in);
		
		while(cin.hasNextDouble()){
			double in[] = new double[8];
			for(int i=0;i<8;i++) in[i]= cin.nextDouble();
			int t1,t2,t3;
			t1= java.awt.geom.Line2D.relativeCCW(in[0],in[1],in[2],in[3],in[6],in[7]);
			t2= java.awt.geom.Line2D.relativeCCW(in[2],in[3],in[4],in[5],in[6],in[7]);
			t3= java.awt.geom.Line2D.relativeCCW(in[4],in[5],in[0],in[1],in[6],in[7]);
			if((t1==1 && t2==1 && t3==1) || (t1==-1 && t2==-1 && t3==-1)) System.out.println("YES");
			else System.out.println("NO");
		}
	}
}

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

struct point
{
    point() : x(0), y(0) { }
    point(double x_, double y_) : x(x_), y(y_) { }
    double x, y;
};
point operator-(const point& a, const point& b) { return point(a.x - b.x, a.y - b.y); }
point operator+(const point& a, const point& b) { return point(a.x + b.x, a.y + b.y); }

bool greaterX(const point& a, const point& b) {
	if (a.x > b.x) return true;
	if (a.x < b.x) return false;
	return (a.y > b.y); 
}
bool greaterY(const point& a, const point& b) {
	if (a.y > b.y) return true;
	if (a.y < b.y) return false;
	return (a.x > b.x); 
}

void show(const point& a){ std::cout << '('<<a.x<<','<<a.y<<')'<<std::endl; }

typedef point vector2d;

double cross(const vector2d& a, const vector2d& b)
{
    return a.x * b.y - a.y * b.x;
}

bool greaterX_(const point& a, const point& b) {
	if (a.x > b.x) return true;
	if (a.x < b.x) return false;
	return (a.y < b.y); 
}

bool point_in_triangle(const point& p, const point& a, const point& b, const point& c)
{
    // p ª ab ÌE¤É êÎOp`ÌO¤É é
    if (cross(p - a, b - a) < 0.0) return false;
    // p ª bc ÌE¤É êÎOp`ÌO¤É é
    if (cross(p - b, c - b) < 0.0) return false;
    // p ª ca ÌE¤É êÎOp`ÌO¤É é
    if (cross(p - c, a - c) < 0.0) return false;
    return true;
}


int main(int,char**){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(std::cin >> x1){
		std::cin >>y1>>x2>>y2>>x3>>y3>>xp>>yp;
		std::vector<point> tri;
		tri.clear();
		tri.push_back(point(x1,y1));
		tri.push_back(point(x2,y2));
		tri.push_back(point(x3,y3));
		std::sort(tri.begin(),tri.end(),greaterX_);
		if(point_in_triangle(point(xp,yp),tri[2],tri[1],tri[0])) std::cout<< "YES"<<std::endl;
		else  std::cout<< "NO"<<std::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 a.real()*b.imag()-a.imag()*b.real();
}

int main(){
  cd a[4];

  for(;;){
    rep(i,4){
      double x,y;
      if(scanf(" %lf %lf", &x,&y)==EOF)
        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[0]-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[0]-a[3]) < 0 ))
      printf("IN\n");
    else
      printf("OUT\n");
  }
  
  return 0;
}