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 <complex>
#include <iostream>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;
typedef complex<double> xy_t;

double cross_product(xy_t a,xy_t b){
	return (conj(a)*b).imag();
}

double x[4],y[4];

int main(){
	while(true){
		rep(i,0,4) cin>>x[i]>>y[i];
		if(!cin) break;
		xy_t a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]),p(x[3],y[3]);
		double pab,pbc,pca;
		pab=cross_product(a-p,b-p);
		pbc=cross_product(b-p,c-p);
		pca=cross_product(c-p,a-p);
		bool ok=0;
		if((pab>0&&pbc>0&&pca>0)||(pab<0&&pbc<0&&pca<0)) ok=1;
		//bool ok=abs(pab+pbc+pca)==abs(pab)+abs(pbc)+abs(pca);
		cout<<(ok?"YES":"NO")<<endl;
	}
}

C++: #include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)

bool judge(double x[2], double y[2]) {
	double cross = x[0] * y[1] - y[0] * x[1];
	if(cross >= 0) return true;
	else return false;
}

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 x[2], y[2];
		x[0] = x2 - x1;
		y[0] = y2 - y1; 
		x[1] = xp - x1;
		y[1] = yp - y1;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			continue;
		}
		x[0] = x3 - x2;
		y[0] = y3 - y2;
		x[1] = xp - x2;
		y[1] = yp - y2;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			continue;
		}
		x[0] = x1 - x3;
		y[0] = y1 - y3;
		x[1] = xp - x3;
		y[1] = yp - y3;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			continue;
		}
		cout << "YES" << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

typedef struct _Point {
	double x;
	double y;
} Point;

typedef struct _Line {
	Point a;
	Point b;
} Line;

typedef struct _Triangle {
	Point a;
	Point b;
	Point c;
} Triangle;

int side(Point p, Line l) {
	int n = p.x * (l.a.y - l.b.y) + l.a.x * (l.b.y - p.y) + l.b.x * (p.y - l.a.y);
	if (n > 0) return 1;
	else if (n < 0) return -1;
	else return 0;
}

bool pointInaTriangle(Point p, Triangle t) {
	Line ab, bc, ca;
	ab.a = t.a; ab.b = t.b;
	bc.a = t.b; bc.b = t.c;
	ca.a = t.c; ca.b = t.a;
	int pab = side(p, ab);
	int pbc = side(p, bc);
	int pca = side(p, ca);
	if (0 < pab && 0 < pbc && 0 < pca)
		return true;
	if (0 > pab && 0 > pbc && 0 > pca)
		return true;
	if (0 <= pab && 0 <= pbc && 0 <= pca)
		return true;
	if (0 >= pab && 0 >= pbc && 0 >= pca)
		return true;
	return false;
}

int main() {
	Triangle t;
	Point p;
	while (cin >> t.a.x >> t.a.y >> t.b.x >> t.b.y >> t.c.x >> t.c.y >> p.x >> p.y) {
		if (pointInaTriangle(p, t) == true)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>


using namespace std;
const int MOD = 1000000009; // check!!!
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)


const double EPS (1e-8);
const double PI=acos(-1.0);

template<class T>
struct point{
    T x,y;
    point() : x(0), y(0) {}
    point(const T& x,const T& y) : x(x), y(y) {}
    point operator+(const point &a)const{ return point(x+a.x,y+a.y); }
    point& operator+=(const point &a){x += a.x; y += a.y; return *this;}
    point operator-(const point &a)const{ return point(x-a.x,y-a.y); }
    point& operator-=(const point &a){x -= a.x; y -= a.y; return *this;}
    point operator*(const double a)const{ return point(a*x,a*y); }
    point& operator*=(const double a){ x *= a; y *= a; return *this;}
    point operator/(const double a)const{ return point(x/a,y/a); }
    point& operator/=(const double a){ x /= a; y /= a; return *this;}
	
	//テヲツッツ氾ィツシツεァツ板ィ
	bool operator<(const point &a)const{return (x != a.x) ? (x < a.x) : (y < a.y);}
 
};

template<class T> T SQ(T x){ return x*x; }
template<class T> T dist2(const point<T> &a,const point<T> &b){return SQ(a.x-b.x)+SQ(a.y-b.y);}
template<class T> T abs2(const point<T>& p){return SQ(p.x) + SQ(p.y);}
template<class T> T abs(const point<T>& p){return sqrt(abs2(p));}
template<class T> T dot(const point<T>& a,const point<T>& b)
{return a.x*b.x + a.y*b.y;}
template<class T> T cross(const point<T>& a,const point<T>& b)
{return a.x*b.y - a.y*b.x;}
template<class T> point<T> rot(const point<T>& a,const double theta){
        return point<T>(a.x*cos(theta)-a.y*sin(theta),
			a.x*sin(theta)+a.y*cos(theta));
}
template<class T>
double arg(const point<T> &a){	double t=atan2(a.y,a.x); return t<0?t+2*PI:t; }

enum{CCW=1,CW=-1,ON=0};
template<class T>
int ccw(const point<T> &a,point<T> b,point<T> c){
	b -= a; c -= a;
    double rdir=cross(b,c);
    double len = abs(b) * abs(c); //ティツェツ、テ・ツキツョテ・ツッツセテァツュツ?(テゥツ?淌・ツコツヲテ」ツ?古」ツつ?」ツ?ーテ」ツ??ヲツ卍づ」ツ?ッテ・ツ、ツ姪」ツ?凖」ツ?凝」ツ??、ツコツ古、ツケツ療」ツ?ォテァツスツョテ」ツ?催ヲツ渉崚」ツ?暗」ツつ?
    if(rdir> EPS * len) return CCW; //cテ」ツ?径bテ」ツつ暗」ツつ甘、ツクツ?テ・ツ渉催ヲツ卍づィツィツ暗・ツ堕ィテ」ツつ?
    if(rdir<-EPS * len) return CW; // cテ」ツ?径bテ」ツつ暗」ツつ甘、ツクツ?テヲツ卍づィツィツ暗・ツ堕ィテ」ツつ?
    return ON; // a,b,cテ」ツ?古、ツクツ?ァツ崢エテァツキツ堙、ツクツ?
}

//テ・ツ、ツ堙ィツァツ津・ツスツ「テ」ツ?ョテゥツ敖「テァツゥツ?
template<class T>
T area(const vector<point<T> >& v){
	T ans = 0;
	for (int i = 2; i < (int)v.size(); i++){
		ans += cross(v[i-1] - v[0],v[i] - v[0]);
	}
	return abs(ans) / 2;
}

typedef point<double> P;

double ar(P& a,P& b,P& c){
	vector<P> v;
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);
	return area(v);
}

template<class T>
std::istream& operator>>(std::istream& is, point<T>& point){return ( is >> point.x >> point.y );}


int main(){
	P p[4];
	while(true){
		p[0].x = INF;
		FOR(i,4) cin>>p[i];
		if(p[0].x == INF) break;

		if(ar(p[0],p[1],p[2]) + EPS >= ar(p[0],p[1],p[3]) + ar(p[0],p[2],p[3]) + ar(p[1],p[2],p[3])){
			puts("YES");
		} else {
			puts("NO");
		}

	}

	return 0;
}