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>
#include <deque>

using namespace std;

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	deque<double> nums;
	
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
	{
		nums.push_back(x1);
		nums.push_back(x2);
		nums.push_back(x3);
		sort( nums.begin(), nums.end());
		
		deque<double>::iterator it = nums.begin();
		double a,b,c,d;

		a = *it;
		it += 2;
		b = *it;

		nums.clear();

		nums.push_back(y1);
		nums.push_back(y2);
		nums.push_back(y3);
		sort( nums.begin(), nums.end());
		
		it = nums.begin();
		c = *it;
		it += 2;
		d = *it;

		int ture=0;
		
		if(xp<a) ;
		else if(b<xp);
		else ture++;

		if(yp<c) ;
		else if(d<yp);
		else ture++;

		if(ture==2) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;

		nums.clear();

	}

	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(int i = f; i < (int)l; ++i)

#ifdef ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif

#define pb emplace_back
#define lb lower_bound
#define ul unsigned long
#define ull unsigned long long
#define ll long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second

#define ALL(c) (c).begin(),(c).end()

#define DBG0(x)    {if(DEBUG){ cout << #x << ": " << x << "\t"; }}
#define DBG(x)     {if(DEBUG){DBG0(x); cout << endl;}}
#define DBG2(x, y) {if(DEBUG){DBG0(x); DBG(y);}}
#define DBG3(x, y, z) {if(DEBUG){DBG0(x); DBG2(y, z);}}
#define DBG4(w, x, y, z) {if(DEBUG){DBG0(w); DBG3(x, y, z);}}

template <class T>
ostream& operator<<(ostream& os, vector<T> xs){ for(T x: xs) os << x << ' '; return os; }
template <class S, class T>
ostream& operator<<(ostream& os, pair<S,T> st){ os << "(" << st.first << "," << st.second <<")"; return os; }

using namespace std;
const double EPS = 1.0e-14;
typedef complex<double> Point;
istream& operator>>(istream& is, Point &pt){
    double a, b;
    is >> a >> b;
    pt.real(a); pt.imag(b);
    return is;
}

ostream& operator<<(ostream& os, const Point &pt){
    os << make_pair(pt.real(), pt.imag());
    return os;
}

inline double cross(const Point &a, const Point &b){
    return (a.real()*b.imag() - a.imag()*b.real());
}

inline double myarg(Point &a){
    double ret = arg(a);
    return (ret >= 0 ? ret : ret + 2*M_PI);
}

inline double signed_area(const Point &a, const Point &b, const Point &c){
    Point ab = b - a;
    Point ac = c - a;
    return cross(ab, ac) / 2.0;
}

inline bool intersect(const Point &a1, const Point &a2, const Point &b1, const Point &b2) {
  return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS) &&
          (cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS));
}

void sort_by_arg(vector<Point> &pts){
    sort(pts.begin(), pts.end(), [](Point a, Point b){ return (myarg(a) < myarg(b)); });
}

double area(vector<Point> &vs){
    int n = vs.size();
    vector<Point> pts(n - 1);
    rep(i, n - 1) pts[i] = vs[i + 1] - vs[0];
    sort_by_arg(pts);
    double ans = 0.0;
    rep(i, n - 1) ans += cross(vs[i], vs[i + 1]);
    return ans / 2.0;
}


typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef vector<bool> vbl;
typedef pair<int, int> pii;

bool counter_clock_wise(const Point &a, const Point &b, const Point &c){
    if(cross(a, b) > 0 && cross(b, c) > 0) return true;
    else return false;
}

int main(void){
    Point a, b, c, p;
    while(cin >> a >> b >> c >> p){
        Point A = b - a;
        Point B = c - a;
        Point P = p - a;
        if(counter_clock_wise(A, P, B) || counter_clock_wise(B, P, A))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

C++: //#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	double x[4],y[4],dx[3],dy[3],dpx[3],dpy[3];
	double th[3], pth[3];
	int check = 0;
	bool ans = true;


	while (	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){
		ans = true;

		if (x[1] == 0 && y[1] == 0){
			swap(x[0], x[1]);
			swap(y[0], y[1]);
		}
		if (x[2] == 0 && y[2] == 0){
			swap(x[0], x[2]);
			swap(y[0], y[2]);
		}
		if (sin(atan2(y[1]-y[0], x[1]-x[0]) - atan2(y[2]-y[0], x[2]-x[0])) > 0){
			swap(x[1], x[2]);
			swap(y[1], y[2]);
		}

		for (int i = 0; i < 3; i++){
			dx[i] = x[(i + 1) % 3] - x[i];
			dy[i] = y[(i + 1) % 3] - y[i];
			dpx[i] = x[3] - x[i];
			dpy[i] = y[3] - y[i];
			th[i] = atan2(dy[i], dx[i]);
			pth[i] = atan2(dpy[i], dpx[i]);
		}

		for (int i = 0; i < 3; i++){
			if (sin(th[i] - pth[i])>0){
				ans = false;
				break;
			}
		}
		cout << (ans ? "YES" : "NO" )<< endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	double x[3],y[3],xp,yp,r,xmax,xmin,ymax,ymin;
	int sum;
	while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
		xmax=max(x[0],max(x[1],x[2]));
		ymax=max(y[0],max(y[1],y[2]));
		xmin=min(x[0],min(x[1],x[2]));
		ymin=min(y[0],min(x[1],x[2]));
		sum=0;
		if(x[0]-x[1]!=0){
		r=(y[0]-y[1])*(xp-x[0])/(x[0]-x[1])+y[0];
			if(yp<r&&r>=ymin&&r<=ymax)
			sum++;
		}
		if(x[0]-x[2]!=0){
		r=(y[0]-y[2])*(xp-x[0])/(x[0]-x[2])+y[0];
		if(yp<r&&r>=ymin&&r<=ymax)
			sum++;
		}
		if(x[2]-x[1]!=0){
		r=(y[2]-y[1])*(xp-x[2])/(x[2]-x[1])+y[2];
			if(yp<r&&r>=ymin&&r<=ymax)
			sum++;
		}
		if(sum==1)
		cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

using namespace std;

typedef complex<double> P;

#define  EPS (1e-10)
#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(x1, y1), b(x2, y2), c(x3, y3), d(xp, yp);

        if ((cross(b - a, d - a) > -EPS) && 
            (cross(c - b, d - b) > -EPS) &&
            (cross(a - c, d - c) > -EPS))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return 0;
}