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 <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};

int main()
{
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while( cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
  double s;
  double a,b,c;
  a =sqrt(pow(x1-x2,2)+pow(y1-y2,2));
  c =sqrt(pow(x1-x3,2)+pow(y1-y3,2));
  b =sqrt(pow(x2-x3,2)+pow(y2-y3,2));
  s =(a+b+c)/2;
  double abcS =sqrt(s*(s-a)*(s-b)*(s-c));
  double ap,bp,cp;
  ap =sqrt(pow(x1-xp,2)+pow(y1-yp,2));
  bp =sqrt(pow(x2-xp,2)+pow(y2-yp,2));
  cp =sqrt(pow(x3-xp,2)+pow(y3-yp,2));
  s =(ap+bp+a)/2;
  double abpS =sqrt(s*(s-ap)*(s-bp)*(s-a));
  s =(bp+cp+b)/2;
  double bpcS =sqrt(s*(s-bp)*(s-cp)*(s-b));
  s =(ap+cp+c)/2;
  double apcS =sqrt(s*(s-ap)*(s-cp)*(s-c));
  if((abpS+bpcS+apcS-abcS)<1e-9)
    cout <<"YES"<<endl;
  else
    cout <<"NO"<<endl;
  
  }
  return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

#include<complex>
typedef complex<double> Point;
double dot(Point a, Point b){
  return real(conj(a) * b);
}
double cross(Point a, Point b){
  return imag(conj(a) * b);
}

int ccw(Point a, Point b, Point c){
  b -= a;
  c -= a;
  if(cross(b, c) > EPS) return +1;
  if(cross(b, c) < -EPS) return -1;
  if(dot(b, c) < 0) return +2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}
// テァツつケテ」ツ?古、ツクツ嘉ィツァツ津・ツスツ「abcテ」ツ?ョテ」ツ?ゥテ」ツ?禿」ツ?ォテ」ツ?づ」ツつ凝」ツ?ョテ」ツ?凝・ツ按、テ・ツョツ堙」ツ?凖」ツつ?
enum { OUT, ON, IN };
int contains(Point a, Point b, Point c, Point p){
  int A = ccw(a, b, p);
  int B = ccw(b, c, p);
  int C = ccw(c, a, p);
  if(A == B && B == C && abs(A) == 1) return IN;
  if(!A || !B || !C) return ON;
  return OUT;
}

int main(){
  Point a, b, c, d;
  while(cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag()){
    int C = contains(a, b, c, d);
    if(C == IN){
      cout << "YES" << endl;
    }else if(C == OUT){
      cout << "NO" << endl;
    }else if(C == ON){
      cout << "ON!" << endl;
    }
  }
  return 0;
}

C++: #include <stdio.h>
#include <math.h>


double eps = 1e-10 ;
int main()
{
  double x1, x2, x3, y1, y2, y3, xp, yp;
  double s, s1, s2, s3;

  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp) != EOF){
    //?????§????¢??????¢???
    s  = ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)) / 2; 
    s1 = ((xp - x1) * (y2 - y1) - (yp - y1) * (x2 - x1)) / 2;
    s2 = ((xp - x1) * (y3 - y1) - (yp - y1) * (x3 - x1)) / 2;
    s3 = ((xp - x2) * (y3 - y2) - (yp - y2) * (x3 - x2)) / 2;

    s  = fabs(s);
    s1 = fabs(s1);
    s2 = fabs(s2);
    s3 = fabs(s3);

    if (s - (s1 + s2 + s3) <= eps) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> P;
#define EPS 1.0e-12
#define F(I,J,N) for(int I=J;I<N;I++)

class Line{
public:
	P p[2];
	P v;
	Line(){}
	Line(P p0,P p1){
		p[0]=p0;
		p[1]=p1;
		v=p1-p0;
	}
	//線分の長さ
	double length(){return abs(v);}
	//平行
	bool Parallel(Line l){
		return (cross(v,l.v)==0);
	}
	//線分上
	bool OnLine(P a){
		return (abs(p[0]-a)+abs(a-p[1])<length()+EPS);
	}
	double cross(Line l){
		return cross(v,l.p[0]-p[0]) * cross(v,l.p[1]-p[0]);
	}
	double cross(P a,P b){
		return (real(a)*imag(b)-imag(a)*real(b));
	}
	bool Intersection(Line l){
		if(Parallel(l)){
			return (OnLine(l.p[0])||OnLine(l.p[1])||l.OnLine(p[0])||l.OnLine(p[1]));
		}
		return ((cross(l)<EPS) && (l.cross(*this))<EPS);
	}
};

class Pi{
private:
	P *p;
	Line *l;
	int n;
public:
	Pi(){}
	Pi(int n){
		this->n=n;
		p=new P[n+1];
		l=new Line[n];
	}
	~Pi(){
		delete []p;
		delete []l;
	}
	void set(int i,P a){
		if(i==0){
			p[0]=a;
			p[n]=a;
		}
		else p[i]=a;
	}
	void set(){
		F(i,0,n) l[i]=Line(p[i],p[i+1]);
	}
	bool isin(P a,double x){
		int cnt=0;
		F(i,0,n) if(l[i].OnLine(a)) return true;
		P out(x,imag(a));
		Line buf(a,out);
		F(i,0,n){
			if(l[i].Intersection(buf)){
				if(imag(l[i].v)!=0){
					if(imag(p[i])<imag(p[i+1])) cnt++;
					else cnt--;
				}
			}
		}
		F(i,n,2*n){
			if(buf.OnLine(p[i%n])){
				if(imag(p[(i-1)%n])!=imag(a) || imag(p[(i+1)%n])!=imag(a)){
					if(imag(p[(i-1)%n])*imag(p[(i+1)%n])<=0){
						if(imag(p[(i-1)%n])>imag(p[(i+1)%n])) cnt++;
						else cnt--;
					}
				}
			}
		}
		if(cnt) return true;
		return false;
	}
};

int main(){
	double a,b,c,d,e,f,g,h;
	P p[3],q;
	Pi *in;
	while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
		p[0]=P(a,b);
		p[1]=P(c,d);
		p[2]=P(e,f);
		q=P(g,h);
		in=new Pi(3);
		F(i,0,3) in->set(i,p[i]);
		in->set();
		if(in->isin(q,-101)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		delete in;
	}
	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> V[3], P;
    while(true){
        double x, y;
        for(int i=0; i<3; i++){
            cin >> x >> y;
            V[i] = {x, y};
        }
        cin >> x >> y;
        P = {x, y};
         
        if(!cin)break;
         
        int sum = 0;
        for(int i=0; i<3; i++){
            sum += cross(V[(i+1)%3]-V[i], (P-V[i])) > 0;
        }
        cout << (sum==0 || sum==3? "YES": "NO") << endl;
    }
    return 0;
}