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 <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define EPS (1e-7)
#define rep(i,n) for(int i=0;i<n;i++)
typedef complex<double> P;

double x,y,xx,yy,xxx,yyy,xxxx,yyyy;

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

int isInsected(P a1, P a2, P b1, P b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int main(){
	while(cin>>x>>y>>xx>>yy>>xxx>>yyy>>xxxx>>yyyy){
		P a=P(x,y),b=P(xx,yy),c=P(xxx,yyy),p=P(xxxx,yyyy);
		int C=!isInsected(a,b,c,p)&&!isInsected(b,c,a,p)&&!isInsected(c,a,b,p);
		cout<<(C?"YES":"NO")<<endl;
	}
}

C++: #include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

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

typedef vector<int> vi;

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF){
		double a1 = (xp-x1)*(y2-y1)-(yp-y1)*(x2-x1);
		bool parity = a1 > 0.0;

		double a2 = (xp-x2)*(y3-y2)-(yp-y2)*(x3-x2);
		if(parity ^ (a2 > 0.0)){
			puts("NO");
			continue;
		}

		double a3 = (xp-x3)*(y1-y3)-(yp-y3)*(x1-x3);
		puts(parity^(a3>0.0) ? "NO" : "YES");
	}
	return 0;
}

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

using namespace std;

#define EPS 1e-5

struct point{
	double x;
	double y;
};
struct line{
	double a;
	double b;
};

int recog_point_position( const point& a , const point&b , const point& c );
bool get_line( const point& a , const point& b , line *a_b );
inline istream& operator >> ( istream& s , point& p );

int main(void)
{
	point a, b, c, p;

	while(1)
	{
		cin >> a >> b >> c >> p;
		if( cin.eof() ) break;

		int result_ab_c = recog_point_position( a , b , c );
		int result_ab_p = recog_point_position( a , b , p );
		int result_bc_a = recog_point_position( b , c , a );
		int result_bc_p = recog_point_position( b , c , p );
		int result_ca_b = recog_point_position( c , a , b );
		int result_ca_p = recog_point_position( c , a , p );

		cout << (( result_ab_c == result_ab_p && result_bc_a == result_bc_p && result_ca_b == result_ca_p ) ? "YES" : "NO") << endl;
	}

	return 0;
}

int recog_point_position( const point& a , const point& b , const point& c )
{
	line a_b;

	bool result = get_line( a , b , &a_b );
	if( result == false )
	{
		if( (a.x + b.x)/2 < c.x ) return 1; // 点が直線より右にある場合に1をリターン
		else return 0;
	}
	else if( result == true )
	{
		if( c.y > a_b.a * c.x + a_b.b ) return 1; // 点が直線より上にある場合に1をリターン
		else return 0;
	}

}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS )
	{
		return false;
	}
	else
	{
		a_b->a = (a.y - b.y) / (a.x - b.x);
		a_b->b = a.y - a_b->a * a.x;

		return true;
	}
}

inline istream& operator >> ( istream& s , point& p )
{
	return s >> p.x >> p.y;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Point{
public:
    double y, x;
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    Point(){
        y = x = 0.0;
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x;
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
};

int main()
{
    for(;;){
        vector<Point> p(3);
        Point p1;
        for(int i=0; i<3; ++i){
            if(!(cin >> p[i].x >> p[i].y))
                return 0;
        }
        cin >> p1.x >> p1.y;

        bool plus = true;
        bool minus = true;
        for(int i=0; i<3; ++i){
            Point p2 = p[(i+1)%3] - p[i];
            Point p3 = p1 - p[i];
            if(p2.cross(p3) < 0)
                plus = false;
            else
                minus = false;
        }
        if(plus || minus)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

C++: struct Vec2 {
  double x, y;
  Vec2(double x_, double y_) : x(x_), y(y_) {}
};

bool in_the_triangle(const Vec2& a, const Vec2& b, const Vec2& c, const Vec2& p) {
  Vec2 aa(a.x-p.x, a.y-p.y);
  Vec2 bb(b.x-p.x, b.y-p.y);
  Vec2 cc(c.x-p.x, c.y-p.y);
  double k = aa.x*bb.y - bb.x*aa.y;
  double l = bb.x*cc.y - cc.x*bb.y;
  double m = cc.x*aa.y - aa.x*cc.y;
  return (k * l > 0 && k * m > 0);
}

int main() {
double a,b,c,d,e,f,g,h;
while (scanf("%f%f%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f,&g,&h)) {
  puts(in_the_triangle(Vec2(a,b),Vec2(c,d),Vec2(e,f),Vec2(g,h)) ? "YES" : "NO");
}
return 0;
}