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++: import java.util.*;   
import java.lang.*;   
import java.math.*;   
import java.io.*; 

public class Main {
	Scanner sc;
	void run() {
		sc = new Scanner(System.in);
		Point[] a = new Point [4]; 
		while (sc.hasNext()){
			for (int i=0;i<4;i++) {
				double x = sc.nextDouble();
				double y = sc.nextDouble();
				a[i] = new Point(x,y);
			}
			Line[] l = new Line[3];
			Line[] lc = new Line [3];
			boolean flg = true;
			for (int i=0;i<3;i++) {
				l[i] = new Line(a[i%3], a[(i+1)%3]);
				lc[i] = new Line(a[(i+2)%3], a[3]);
				if (l[i].judgeCloss(lc[i])) {
					flg = false;
					break;
				}
			}
			if (flg)
				System.out.println("YES");
			else System.out.println("NO");
			
		}
		
	}
	public static void main(String[] args) {
		new Main().run();
	}
	
	
}
class Point {
	private double x;
	private double y;
	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}
	public double getX(){
		return x;
	}
	public double getY() {
		return y;
	}
}

class Line {
	Point a1;
	Point a2;
	public Line (Point a, Point b) {
		a1 = a;
		a2 = b;
	}
	public Point getS() {
		return a1;
	}
	public Point getE() {
		return a2;
	}
	public boolean judgeCloss(Line l) {
		double a = ( (a1.getY() - l.getS().getY()) * (l.getS().getX() - l.getE().getX() - (l.getS().getY() - l.getE().getY()) * (a1.getX() - l.getS().getX())) );
		double b = ( (a2.getY() - l.getS().getY()) * (l.getS().getX() - l.getE().getX() - (l.getS().getY() - l.getE().getY()) * (a2.getX() - l.getS().getX())) );
		
//		System.out.println( a + " " + b );
		
		if (a*b >= 0)
			return false;
		else return true;
	}

}

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

using namespace std;

struct point {
	double x, y;
}A, B, C, P;

double crossProd(point A, point B, point C) {
	return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

int main() {
	while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &P.x, &P.y) != EOF) {
		if (crossProd(A, B, P) > 0 && crossProd(B, C, P) > 0 && crossProd(C, A, P) > 0
		 || crossProd(A, P, B) > 0 && crossProd(B, P, C) > 0 && crossProd(C, P, A) > 0) puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
  
double cross(complex<double> A, complex<double> B){
	return (conj(A)*B).imag();
}
 
int main(){
    complex<double> Points[3], P;
    while(true){
        double x, y;
        for(int i=0; i<3; i++){
            cin >> x >> y;
            Points[i] = {x, y};
        }
        cin >> x >> y;
        P = {x, y};
         
        if(!cin)break;
         
        int sum = 0;
        for(int i=0; i<3; i++){
            sum += cross(Points[(i+1)%3]-Points[i], (P-Points[i])) > 0;
        }
        cout << (sum==0 || sum==3? "YES": "NO") << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

struct Vector {
  double x, y;
  Vector() {}
  Vector(double x, double y): x(x), y(y) {}
  Vector operator+(Vector v) { return Vector(x + v.x, y + v.y); }
  Vector operator-(Vector v) { return Vector(x - v.x, y - v.y); }
  Vector operator*(double k) { return Vector(x * k, y * k); }
  Vector operator/(double k) { return Vector(x / k, y / k); }
  bool operator==(Vector v)  { return abs(x - v.x) < 1e-10 && abs(y - v.y) < 1e-10; }
  friend void input(Vector &v) { cin >> v.x >> v.y; }
  friend double norm(Vector v) { return dot(v, v); }
  friend double  abs(Vector v) { return sqrt(norm(v)); }
  friend double   dot(Vector v1, Vector v2) { return v1.x * v2.x + v1.y * v2.y; }
  friend double cross(Vector v1, Vector v2) { return v1.x * v2.y - v1.y * v2.x; }
  friend void show(Vector v) { if (abs(v.x) < 1e-10) v.x = 0.0; if (abs(v.y) < 1e-10) v.y = 0.0; printf("%.10f %.10f\n", v.x, v.y); }
  friend bool ccw(Vector v, Vector v1, Vector v2) { return cross(v1 - v, v2 - v) > 1e-10; }
  friend bool  cw(Vector v, Vector v1, Vector v2) { return cross(v1 - v, v2 - v) < -1e-10; }
  friend bool parallel(Vector v1, Vector v2) { return abs(cross(v1, v2)) < 1e-10; }
  friend bool onLine(Vector v, Vector v1, Vector v2) { return v == v1 || v == v2 || (parallel(v1 - v, v2 - v) && dot(v1 - v, v2 - v) < -1e-10); }
  friend int direct(Vector v1, Vector v2, Vector v) { if (ccw(v1, v2, v)) return  1; if ( cw(v1, v2, v)) return -1; if (dot(v2 - v1, v - v1) < -1e-10) return  2; if (dot(v1 - v2, v - v2) < -1e-10) return -2; return 0; }
};
typedef Vector Point;

int main(void) {
  Point p[4];
  while (cin >> p[0].x >> p[0].y) {
    for (int i = 1; i < 4; i++) {
      input(p[i]);
    }

    cout << ((ccw(p[3], p[0], p[1]) && ccw(p[3], p[1], p[2]) && ccw(p[3], p[2], p[0])) || (cw(p[3], p[0], p[1]) && cw(p[3], p[1], p[2]) && cw(p[3], p[2], p[0])) ? "YES" : "NO") << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

double operator *( pair<double,double> p1,pair<double,double> p2){
    return p1.first*p2.second-p2.first*p1.second;
}
int main(){
    double x[3],y[3],xp,yp;
    while(cin>>x[0]>>y[0]){
        for(int i=1;i<3;i++)
            cin>>x[i]>>y[i];
        cin>>xp>>yp;
        pair<double,double>vec[3];
        for(int i=0;i<3;i++)
            vec[i]=make_pair(x[(i+1)%3]-x[i],y[(i+1)%3]-y[i]);
        pair<double,double>tes[3];
        for(int i=0;i<3;i++)
            tes[i]=make_pair(xp-x[i],yp-y[i]);
        int suc=1;
        for(int i=0;i<3;i++){
            if((vec[i]*vec[(i+1)%3])*(vec[i]*tes[(i+1)%3])<0){
                suc=0;
                break;
            }
        }
        if(suc==1)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }

}

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

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

typedef struct POINT_tag{ double x, y; }POINT_t;
typedef struct LINE_tag{ POINT_t a, b;}LINE_t;
typedef struct TRIAGNLE_tag{ POINT_t a, b, c;}TRIANGLE_t;

int side(POINT_t *p, LINE_t *e){
  POINT_t p1 = *p;
  POINT_t p2 = e->a;
  POINT_t p3 = e->b;

  const int n =  p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y);
  if(n > 0) return 1;
  else return -1;
}

int solve(POINT_t *p, TRIANGLE_t *t){
  LINE_t 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;
  const int pab = side(p, &ab);
  const int pbc = side(p, &bc);
  const int pca = side(p, &ca);

  if((0 < pab) && (0 < pbc) && (0 < pca)) return 1;
  if((0 > pab) && (0 > pbc) && (0 > pca)) return 1;

  return 0;
}

int main(){
  POINT_t p;
  TRIANGLE_t t;
  while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &t.a.x, &t.a.y, &t.b.x, &t.b.y, &t.c.x, &t.c.y, &p.x, &p.y)==8){
    if(solve(&p, &t)) puts("YES");
    else puts("NO");
  }
  return 0;
}

C++: def side(p1, p2, p3):
    return (p3[1]-p1[1])*(p2[0]-p1[0])-(p2[1]-p1[1])*(p3[0]-p1[0])>0

while True:
    try:
        x = map(float, raw_input().split())
        p1 = x[0:2]
        p2 = x[2:4]
        p3 = x[4:6]
        p0 = x[6:]
        if (side(p1, p2, p0)==side(p2, p3, p0) and side(p2, p3, p0)==side(p3, p1, p0)):
            print "YES"
        else:
            print "NO"
    except:
        break