Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;

namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(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);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

typedef vector<P> G;

struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}


//直線と直線の交差
bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
    abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}
bool intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
    cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}
bool intersectLP(const L &l, const P &p) {
  return abs(cross(l[1]-p, l[0]-p)) < EPS;
}

//線分と線分の交差
bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}


bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

int main()
{
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    int b1 = ccw(P(x1,y1),P(x2,y2),P(xp,yp));
    int b2 = ccw(P(x2,y2),P(x3,y3),P(xp,yp));
    int b3 = ccw(P(x3,y3),P(x1,y1),P(xp,yp));
    
    if((b1==b2) && b2 == b3 && b3 == b1)cout << "YES\n";
    else cout << "NO\n";

  }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main() {
	double x[3], y[3], p, q;
	while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>p>>q) {
		bool f[3];
		for (int i = 0; i < 3; i++) {
			if ((x[i % 3] - p)*(y[(i + 1) % 3] - q) - (y[i % 3] - q)*(x[(i + 1) % 3] - p) <= 0)f[i] = false;
			else f[i] = true;
		}
		if (f[0]==f[1]&&f[1]==f[2])puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>

using namespace std;

double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
  
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}

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

int is_point_on_line(point a, point b, point c) {
  return cross(b-a, c-a)==0.0 &&
         (dot(b-a, c-a) > -EPS) &&
         (dot(a-b, c-b) > -EPS);
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {

  if(cross(a1-a2,b1-b2)==0){
    return is_point_on_line(a1,a2,b1) || is_point_on_line(a1,a2,b2) 
        || is_point_on_line(b1,b2,a1) || is_point_on_line(b1,b2,a2);
  }
  else {
    return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
           ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
  }
}

int inside(point p, vector<point> ps){
  point a,b;
  a=b=p;

  b.x=1000000;

  int n=ps.size();
  ps.push_back(ps[0]);

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<n;i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;
  
  for(int i=0;i<n;i++){
    if(is_point_on_line(ps[i],ps[i+1],p))return 0;
  }
  
  int cnt1=0;
  for(int i=0;i<n;i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  int cnt=0;
  for(int i=0;i<n;i++)
    if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;
  
  return (cnt-cnt1)%2;
}

int main(void){
 
  point in[4],p;
  vector<point>ps;

  while(cin>>in[1].x>>in[1].y>>in[2].x>>in[2].y>>in[3].x>>in[3].y>>p.x>>p.y){

    ps.clear();

    for(int i=1;i<4;i++)
    ps.push_back(in[i]);

    if(inside(p,ps))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int main(){
	double x[4], y[4];
	bool b, in;
	double ax, ay, px, py;
	double theta;

	b = false;
	for(int i = 0; i < 4; i++){
		if(cin >> x[i] >> y[i]){
			if(i == 3){
				b = true;
			}
		}
	}
	while(b){
		in = true;
		for(int i = 0; i < 3; i++){
			ax = x[(i+1)%3]-x[i];
			ay = y[(i+1)%3]-y[i];
			px = x[3] - x[i];
			py = y[3] - y[i];
			if( ax*py-px*ay < 0){
				in = false;
				break;
			}
		}

		if(in){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}

		b = false;
		for(int i = 0; i < 4; i++){
			if(cin >> x[i] >> y[i]){
				if(i == 3){
					b = true;
				}
			}
		}
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
bool judge_Cross(int, int,int,int);

int main() {
	float x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		float pax = x1 - xp;
		float pay = y1 - yp;
		float pbx = x2 - xp;
		float pby = y2 - yp;
		float pcx = x3 - xp;
		float pcy = y3 - yp;

		if ((judge_Cross(pax, pay, pbx, pay) && judge_Cross(pbx, pby, pcx, pcy) && judge_Cross(pax, pay, pcx, pcy)) ||
			!((judge_Cross(pax, pay, pbx, pay) || judge_Cross(pbx, pby, pcx, pcy) || judge_Cross(pax, pay, pcx, pcy)))) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

bool judge_Cross(int x1,int y1,int x2,int y2) {
	if (x1 * y2 - x2 * y1 > 0) {
		return true;
	} else {
		return false;
	}
}

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 abs(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;
}