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 <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <complex>

using namespace std;
typedef complex<double> xy_t;
double x[4], y[4];

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

bool three(double s, double t, double u){
	if(s * t > 0 && s * u > 0) return true;
	else return false;
}


int main(void){
	while(true){
		for (int i = 0; i < 4; ++i){
			cin >> x[i] >> y[i];
		}
		if(!cin) break;

		xy_t a(x[0], y[0]), b(x[1], y[1]), c(x[2], y[2]), p(x[3], y[3]);

		double apb, bpc, cpa;
		apb = cross_product(a - p, b - p);
		bpc = cross_product(b - p, c - p);
		cpa = cross_product(c - p, a - p);

		bool ok = three(apb, bpc, cpa);
		cout << (ok ? "YES" : "NO") << endl;
		
	}
	
    return 0;
}

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


class vector_t {
public:
  double x;
  double y;
  double z;

public:
  vector_t(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {};

public:
  vector_t operator^(const vector_t& v) const {
    return vector_t(y * v.z - z * v.y,
                    z * v.x - x * v.z,
                    x * v.y - y * v.x);
  };
};


class point_t {
public:
  double x;
  double y;
  double z;
  double w;

public:
  point_t(double x = 0, double y = 0, double z = 0, double w = 1) : x(x), y(y), z(z), w(w) {};
  
public:
  vector_t operator-(const point_t& p) const {
    return vector_t(x - p.x, y - p.y, z - p.z);
  };
};


class point_triangle_intersect : public std::unary_function<point_t, bool> {
public:
  point_triangle_intersect(const point_t& p1,
                           const point_t& p2,
                           const point_t& p3) : p1_(p1), p2_(p2), p3_(p3)
  {
  };

public:
  bool operator()(const point_t& p) const {
    if (((p2_ - p1_) ^ (p - p1_)).z >= 0 &&
        ((p3_ - p2_) ^ (p - p2_)).z >= 0 &&
        ((p1_ - p3_) ^ (p - p3_)).z >= 0)
      
      return true;

    if (((p2_ - p1_) ^ (p - p1_)).z <= 0 &&
        ((p3_ - p2_) ^ (p - p2_)).z <= 0 &&
        ((p1_ - p3_) ^ (p - p3_)).z <= 0)
      
      return true;

    return false;
  };

private:
  point_t p1_;
  point_t p2_;
  point_t p3_;
};


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

  while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    point_t p1(x1, y1);
    point_t p2(x2, y2);
    point_t p3(x3, y3);
    point_t p (xp, yp);

    if (point_triangle_intersect(p1, p2, p3)(p)) {
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;
    }
  }
}

C++: #include <iostream>
#include <stdio.h>
#include <utility>
using namespace std;
int main(){
	double px,py;
	double tx[3],ty[3];
	bool flag;
	bool v[3];
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&tx[0],&ty[0],&tx[1],&ty[1],&tx[2],&ty[2],&px,&py) == 8){
		for(int i=0;i<3;i++){
			tx[i]=tx[i]-px;
			ty[i]=ty[i]-py;
		}
		for(int i=0;i<3;i++){
			if((tx[i%3]*ty[(i+1)%3])-(ty[i%3]*tx[(i+1)%3])<0){
				v[i]=true;
			}else{
				v[i]=false;
			}
		}
		
		if(v[0]!=v[1]){
			cout<<"NO"<<endl;
		}else if(v[1]!=v[2]){
			cout<<"NO"<<endl;
		}else {
			cout<<"YES"<<endl;
		}
	}
	return 0;
}

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

int main(){
  float x1,y1,x2,y2,x3,y3,xp,yp;
  float a1,b1,a2,b2,A,B;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
    a1=x2-x1;
    a2=y2-y1;
    b1=x3-x1;
    b2=y3-y1;
    xp=xp-x1;
    yp=yp-y1;
    A=(b1*yp-b2*xp)/(a2*b1-a1*b2);
    B=(a2*xp-a1*yp)/(a2*b1-a1*b2);
    if(A+B<1&&A>0&&B>0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <cstdio>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){

float x[3],y[3],xp,yp,detA,s,t;

while(scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&xp,&yp) != EOF){

detA=(x[2]-x[0])*(y[1]-y[0])-(x[1]-x[0])*(y[2]-y[0]);
s=((y[1]-y[0])*(xp-x[0])-(x[1]-x[0])*(yp-y[0]))/detA;
t=(-(y[2]-y[0])*(xp-x[0])+(x[2]-x[0])*(yp-y[0]))/detA;

if(0 < s && s < 1 && 0 < t && t < 1)
	printf("YES\n");
else
	printf("NO\n");

}
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=DBL_MAX;

  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 1;
  }
  
  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)%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;
}