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 <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;
    }
    debug(s);
    debug(t);
    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;
    }
    Ans(flag);
  }
  return 0;
}

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

using namespace std;

typedef complex<double> P;

#define  EPS (1e-11)
#define  EQ(a, b)  (abs((a) - (b)) < EPS)
#define  EQV(a, b)  (EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))

double cross(P a, P b) 
{
    return (a.real() * b.imag() - a.imag() * b.real());
}

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

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        P a = P(x1, y1);
        P b = P(x2, y2);
        P c = P(x3, y3);
        P x = P(xp, yp);

        cout << (b - a).real() << " " << (b - a).imag() << "\n";
        cout << (x - a).real() << " " << (x - a).imag() << "\n";
        cout << (c - b).real() << " " << (c - b).imag() << "\n";
        cout << (x - b).real() << " " << (x - b).imag() << "\n";
        cout << (a - c).real() << " " << (a - c).imag() << "\n";
        cout << (x - c).real() << " " << (x - c).imag() << "\n";
        cout << cross(b - a, x - a) << "\n";
        cout << cross(c - b, x - b) << "\n";
        cout << cross(a - c, x - c) << "\n";
        
        if ((cross(b - a, x - a) > EPS &&
             cross(c - b, x - b) > EPS &&
             cross(a - c, x - c) > EPS) ||
            (cross(b - a, x - a) < -EPS &&
             cross(c - b, x - b) < -EPS &&
             cross(a - c, x - c) < -EPS))
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}

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

int main()
{
	double x1, x2, x3, y1, y2, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		vector<bool> vec(3, true);
		if (x1 * y2 - y1 * x2 < 0) vec[0] = false;
		if (x2 * y3 - y2 * x3 < 0) vec[1] = false;
		if (x3 * y1 - y3 * x1 < 0) vec[2] = false;
		if (vec[0] * vec[1] * vec[2] || !(vec[0] + vec[1] + vec[2])) cout << "YES";
		else cout << "NO";
		cout << endl;
	}
}

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

using namespace std;

typedef complex<double> Point;

double prod(const Point &v1, const Point &v2) {
    return v1.real()*v2.imag() - v2.real()*v1.imag();
}

bool ccw(const Point &p1, const Point &p2, const Point &p3) {
    return prod(p2-p1, p3-p1) < 0;
}

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        Point p1(x1, y1), p2(x2, y2), p3(x3, y3), pp(xp, yp);
        bool f1 = ccw(p1, p2, pp), f2 = ccw(p2, p3, pp), f3 = ccw(p3, p1, pp);
        if(f1 == f2 && f2 == f3) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}