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>
#include<algorithm>
using namespace std;
int main(){
	double x[3],y[3],px,py;
	while(cin>>x[0]>>y[0]){
		for(int i=1;i<3;i++)cin>>x[i]>>y[i];
		cin>>px>>py;
		bool ok=true;
		for(int i=0;i<3;i++){
			bool plus=false;
			if(x[(i+1)%3]==x[(i+2)%3]){
				if(x[i]>x[(i+1)%3])plus=true;
			}
			else{
				double a,b;
				a=(x[i]+x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
				b=(y[i]+y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
				if(a>b)plus=true;
			}
			bool pnt=false;
			if(x[(i+1)%3]==x[(i+2)%3]){
				if(px>x[(i+1)%3])pnt=true;
			}
			else{
				double a,b;
				a=(px+x[(i+1)%3])*(y[(i+2)%3]-y[(i+1)%3]);
				b=(py+y[(i+1)%3])*(x[(i+2)%3]-x[(i+1)%3]);
				if(a>b)pnt=true;
			}
			if(pnt!=plus)ok=false;
		}
		if(ok)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

using namespace std;

#define REPEAT(i,a,b)   for(int i=(a); i<(b); i++)
#define REP(i, n)       REPEAT(i, 0, n)
#define ALL(c)          (c).begin(), (c).end()

#define X real()
#define Y imag()
typedef double D;
typedef complex<double> P;
const double EPS = 1e-9;
const int INF = 1000000;
#define pr(n) do { cout << #n " = " << (n) << endl; } while(0)

int main(void){
    double x[3] ,y[3], xp, yp;
    while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
        P p[3];
        P target(xp,yp);
        for(int i=0; i<3; i++){
            p[i] = P(x[i],y[i]);
        }
        P a = p[1]-p[0];
        P b = p[2]-p[0];
        if(a.X*b.Y - a.Y*b.X < 0) swap(p[2],p[1]);
        bool ok = true;
        for(int i=0; i<3; i++){
            P pp = p[(i+1)%3] - p[i];
            P tar = target - p[i];
            tar/=pp;
            if(0 < tar.X && tar.X < 1 && tar.Y > 0){}
            else {
                ok = false;
                break;
            }
        }
        cout << (ok ? "YES" : "NO") << endl;
    }            
}

C++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

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 P{
  double x,y;
  P(){}
  P(double _x,double _y):x(_x),y(_y){}
  P operator + (P p){
    return P(add(x,p.x) ,add(y,p.y));
  }
  P operator - (P p){
    return P(add(x,-p.x) ,add(y,-p.y));
  }
  P operator * (double d){
    return P(x * d,y * d);
  }
  double dot(P p){
    return add(x * p.x,y*p.y);
  }
  double det(P p){
    return add(x*p.y,-y*p.x);
  }
  double dist2(P p){
    return ((*this-p).x * (*this-p).x) + ((*this-p).y * (*this-p).y);
  }
  double GetSlope(P &p){
    P tmp = *this - p;
    return tmp.y/tmp.x;
  }
};
//???????????????????????¨?????????
bool on_seg(P p1,P p2,P q){
  return (p1-q).det(p2-q) == 0 && (p1-q).dot(p2-q) <= 0;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,c,d,e,f,xp,yp;
  while(cin >> a >> b >> c >> d >> e >> f >> xp >> yp){
    bool flag = true;
    double acx = c-a,abx = e-a,acy = d-b,aby = f-b,apx = xp-a,apy = yp - b;
    P p1 = P(a,b),p2 = P(c,d),p3 = P(e,f),p4 = P(xp,yp);
    double t,s;
    if(acx == 0){
      s = apx/ abx;
      t = (apy - s * aby)/acy;
    }
    else if(acy == 0){
      s = apy/aby;
      t = (apx - s * abx)/acx;
    }
    else if(abx == 0){
      t = apx / acx;
      s = (apy- t * acy)/aby;
    }
    else if(aby == 0){
      t = apy/acy;
      s = (apx - t * acx)/abx;
    }
    else{
      t = (abx * apy - apx * aby)/(acy - acx*aby);
      s = (apx - t * acx)/abx;
    }
    if(on_seg(p1,p2,p4) || on_seg(p1,p3,p4) || on_seg(p2,p3,p4)){
      flag = false;
    }
    else{
      flag = 0 < t+s && t+s < 1 && s > 0 && t > 0;
    }
    Ans(flag);
  }
  return 0;
}

C++: #include <cstdio>

using namespace std;

double nx[4], ny[4], a[3], b[3], c[3];

void line(double ax, double ay, double bx, double by, double *a, double *b, double *c)
{

  if(ax == bx){
    *b = 0;
    *c = ax;
    return;
  }
  if(ay == by){
    *a = 0;
    *c = ay;
    return;
  }

  double aa = ax - bx;
  double bb = ay - by;
  *a = bb / aa;
  *c = (*b) * ay - (*a) * ax;
}

int position(double a, double b, double c, double px, double py)
{
  if(a == 0)
    return c<py?1:-1;

  if(b == 0)
    return c<px?1:-1;

  return (a * px + c < py)?1:-1;
}

int main()
{
  while(scanf("%lf%lf", &nx[0], &ny[0]) != -1){
    for(int i=0;i<3;i++) a[i] = b[i] = c[i] = 1;
    
    for(int i=1;i<4;i++)
      scanf("%lf%lf", &nx[i], &ny[i]);

    line(nx[0], ny[0], nx[1], ny[1], &a[0], &b[0], &c[0]);
    line(nx[1], ny[1], nx[2], ny[2], &a[1], &b[1], &c[1]);
    line(nx[0], ny[0], nx[2], ny[2], &a[2], &b[2], &c[2]);

    //    for(int i=0;i<3;i++)
    //      printf("%lf %lf %lf\n", a[i], b[i], c[i]);
    
    puts((position(a[0], b[0], c[0], nx[2], ny[2]) * position(a[0], b[0], c[0], nx[3], ny[3]) > 0 &&
	  position(a[1], b[1], c[1], nx[0], ny[0]) * position(a[1], b[1], c[1], nx[3], ny[3]) > 0 &&
	  position(a[2], b[2], c[2], nx[1], ny[1]) * position(a[2], b[2], c[2], nx[3], ny[3]) > 0)?"YES":"NO");
  }
  return 0;
}