Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include "bits/stdc++.h"
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)



#define EPS (1e-10)
class P{                    //???
public:
    double x,y;
    
    P(double _x=0,double _y=0):x(_x),y(_y){};
    P operator + (P &p     ){ return P( x+p.x , y+p.y ); }  //??????
    P operator - (P &p     ){ return P( x-p.x , y-p.y ); }  //??????
    P operator * (double k ){ return P( x*k   , y*k    ); } //??????
    P operator / (double k ){ return P( x/k   , y/k    ); } //??????
    
    bool operator == (const P &p){ return ( fabs(x-p.x)<EPS && fabs(y-p.y)<EPS ); }
    //    bool operator < (const P &p)const{ return ( x!=p.x ? x<p.x:y<p.y ); }
    
    double norm(){ return x*x+y*y; }        //?????????
    double abs() { return sqrt(norm()); }   //??§??????
    
};
struct L{P p1,p2;};         //??´???
typedef vector<P> Polygon;  //????§???¢
typedef P Vector;           //????????????

double dot  (Vector a,Vector b){ return a.x*b.x+a.y*b.y; }
double cross(Vector a,Vector b){ return a.x*b.y-a.y*b.x; }

int ccw(P p0,P p1,P p2){    //AOJ_BOOK_P386 verified
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    
    if( cross(a,b) > EPS  ) return 1 ;      //COUNTER_CLOCKWISE
    if( cross(a,b) < -EPS ) return -1;      //CLOCKWISE
    if( dot(a,b)   < -EPS ) return 2;       //ONLINE_BACK
    if( a.norm()   < b.norm() ) return -2;  //ONLINE_FRONT
    
    return 0;                               //ON_SEGMENT;
}

//?????????????????? verified
bool intersect(P p1,P p2,P p3,P p4){ return ( ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0 && ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0 ); }

//????????¨???????????¢ verified ARC042-B
double distance_l_p(L l, P p) { return abs(cross(l.p2-l.p1, p-l.p1)) /(l.p2-l.p1).abs(); }

//????????¨??????????????????(????????£???????????´??????????????±???)
bool intersect_circle_point(P center, double r, L line){
    if( distance_l_p(line,center) <= r+EPS ) return true;
    return false;
}


//????´?????§???¢??????
bool isSimple( Polygon pol ){
    //???????????????????????????pol?????\????????????
    size_t pol_size = pol.size()-1;
    rep(i,pol_size){
        for(int j=i+2;j<pol_size;j++){
            if( i==j || i==(j-1+pol_size)%pol_size || i==(j+1+pol_size)%pol_size )continue;
            if( intersect(pol[i], pol[i+1], pol[j], pol[j+1]) )return false;
        }
    }
    return true;
}


//?????????????§???¢????????´?????????????????????????±??????? true???????????´ verified AOJ0012
bool isPointInsidePolygon(vector<L> side,P p){
    int c=0, sideSum=side.size();
    
    rep(i,sideSum){
        if( cross(side[i].p2-side[i].p1,p-side[i].p1) ) c++;
    }
    return !(c%sideSum);
}


int main(){
    double a,b,c,d,e,f,g,h;
    while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
        vector<L> angle;
        angle.pb( L{P(a,b),P(c,d)} );
        angle.pb( L{P(c,d),P(e,f)} );
        angle.pb( L{P(e,f),P(a,b)} );
        
        if(isPointInsidePolygon(angle,P(g,h))){
            cout<<"YES"<<endl;
        }
        else cout<<"NO"<<endl;
    }
    
    
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Point
{
	double x, y;

	Point()
	{
		x = y = 0;

		return;
	}

	Point( int x, int y ) : x( x ), y( y )
	{
		return;
	}

	Point operator - ( Point a )
	{
		return Point( x - a.x, y - a.y );
	}
};

double cross( const Point &a, const Point &b )
{
	return a.x * b.y - a.y * b.x;
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	Point a, b, c, p;

	while ( cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y )
	{
		vector< Point > vecs;

		vecs.PB( a - p );
		vecs.PB( b - p );
		vecs.PB( c - p );
		vecs.PB( a - p );

		int sum = 0;

		REP( i, 0, 3 )
		{
			sum += cross( vecs[i], vecs[ i + 1 ] ) < 0 ? -1 : 1;
		}

		if ( abs( sum ) == 3 )
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <cstdio>
#include <cmath>
using namespace std;
typedef long long lint;

#define EPS 1e-10

struct point { double x, y; };

int main()
{
    point p[4];

    while (~scanf("%lf %lf", &p->x, &p->y)){
        for (int i = 1; i < 4; i++) scanf("%lf %lf", &p[i].x, &p[i].y);

        double p_side[3], side[3];
        for (int i = 0; i < 3; i++){
            p_side[i] = sqrt((p[i].x - p[3].x) * (p[i].x - p[3].x) + (p[i].y - p[3].y) * (p[i].y - p[3].y));
            side[i] = sqrt((p[(i + 1) % 3].x - p[i].x) * (p[(i + 1) % 3].x - p[i].x) + (p[(i + 1) % 3].y - p[i].y) * (p[(i + 1) % 3].y - p[i].y));
        }

        double p_s[3], s;
        for (int i = 0; i < 3; i++){
            double tmp = (p_side[i] + p_side[(i + 1) % 3] + side[i]) / 2;
            p_s[i] = sqrt(tmp * (tmp - p_side[i]) * (tmp - p_side[(i + 1) % 3]) * (tmp - side[i]));
        }
        double tmp = (side[0] + side[1] + side[2]) / 2;
        s = sqrt(tmp * (tmp - side[0]) * (tmp - side[1]) * (tmp - side[2]));

        //printf("%.20f\n", p_s[0] + p_s[1] + p_s[2] - s);
        if (p_s[0] + p_s[1] + p_s[2] - s <= EPS) puts("YES");
        else puts("NO");
    }

    return 0;
}