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<cstdio>
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) == 8)
	{
		double a1, b1, c1, a2, b2, c2, a3, b3, c3;
		if(x1 == x2)
		{
			a1 = 1.0;
			b1 = 0.0;
			c1 = x1;
		}
		else if(y1 == y2)
		{
			a1 = 0.0;
			b1 = 1.0;
			c1 = y1;
		}
		else
		{
			b1 = 1.0;
			a1 = -1.0 * (y2 - y1) / (x2 - x1);
			c1 = a1 * x1 + b1 * y1;
		}
		if((a1 * x3 + b1 * y3 - c1) * (a1 * xp + b1 * yp - c1) <= 0)
		{
			printf("NO\n");
			continue;
		}
		if(x1 == x3)
		{
			a2 = 1.0;
			b2 = 0.0;
			c2 = x1;
		}
		else if(y1 == y3)
		{
			a2 = 0.0;
			b2 = 1.0;
			c2 = y1;
		}
		else
		{
			b2 = 1.0;
			a2 = -1.0 * (y3 - y1) / (x3 - x1);
			c2 = a1 * x1 + b1 * y1;
		}
		if((a2 * x2 + b2 * y2 - c2) * (a2 * xp + b2 * yp - c2) <= 0)
		{
			printf("NO\n");
			continue;
		}
		if(x2 == x3)
		{
			a3 = 1.0;
			b3 = 0.0;
			c3 = x2;
		}
		else if(y2 == y3)
		{
			a3 = 0.0;
			b3 = 1.0;
			c3 = y2;
		}
		else
		{
			b3 = 1.0;
			a3 = -1.0 * (y3 - y2) / (x3 - x2);
			c3 = a2 * x2 + b2 * y2;
		}
		if((a3 * x1 + b3 * y1 - c3) * (a3 * xp + b3 * yp - c3) <= 0)
		{
			printf("NO\n");
			continue;
		}
		printf("YES\n");
	}
	return 0;
}

C++: #include <iostream>

#define SIZE 3

using namespace std;

int main() {
	float x[SIZE], y[SIZE], xp, yp, a, b, c;

	while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp) {
		a = (xp - x[0]) * (yp - y[1]) - (yp - y[0]) * (xp - x[1]);
		b = (xp - x[1]) * (yp - y[2]) - (yp - y[1]) * (xp - x[2]);
		c = (xp - x[2]) * (yp - y[0]) - (yp - y[2]) * (xp - x[0]);

		if ((a > 0 && b > 0 && c > 0) || (a < 0 && b < 0 && c < 0)) {
			cout << "YES";
		}
		else {
			cout << "NO";
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

typedef complex<double> point;
double cross(point a,point b){
    return imag(conj(a)*b);
}
double dot(point a,point b){
    return real(conj(a)*b);
}
int ccw(point a,point b,point c){
    b -= a; c-= a;
    if(cross(b,c) > 0) return 1;
    if(cross(b,c) < 0) return -1;
    if(dot(b,c) < 0) return 2;
    if(norm(b) < norm(c) ) return -2;
    return 0;
}

int main(){
    while(cin){
        vector<point> P;
        for(int i=0;i<3;i++){
            double y,x;
            if(not (cin >> x >> y)){
                goto end;
            }
            P.push_back(point(x,y));
        }
        point inner;
        cin >> inner.real() >> inner.imag();
        if(ccw(P[0],P[1],inner) == 1 and
                ccw(P[1],P[2],inner) == 1  and
                ccw(P[2],P[0],inner) == 1){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
end:;
    return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;

// ??????: a.x*b.x
double dot_product(xy_t a, xy_t b) { 
  return (conj(a)*b).real(); 
}
// ??????: a.x*b.y - b.x*a.y
// ????§???¢????¬????????????¢????????????
double cross_product(xy_t a, xy_t b) { 
  return (conj(a)*b).imag(); 
}
// ?????±: ????????¨ p ??????????????´?????? b ????????±
xy_t projection(xy_t p, xy_t b) { 
  return b*dot_product(p,b)/norm(b); 
}

double x[4], y[4];
int main() {
while (true) {
  for (int i=0; i<4; ++i) 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]);
  // pab ????¬????????????¢?????? 2 ??????,cross product(a-p,b-p)
  // pbc ????¬????????????¢?????? 2 ??????,cross product(b-p,c-p)
  // pca ????¬????????????¢?????? 2 ??????,cross product(c-p,a-p)
  int aaa = 0;
  if (cross_product(a-p,b-p) > 0) aaa++;
  if (cross_product(b-p,c-p) > 0) aaa++;
  if (cross_product(c-p,a-p) > 0) aaa++;
  bool ok = false;
  if (aaa == 3 || aaa == 0) ok = true;
  cout << (ok ? "YES" : "NO") <<  endl;
  }
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

const double EPS = 1e-8;

typedef complex<double> Point;
typedef vector<Point> Polygon;

inline int sign(double x){
    return (x > EPS ? 1 : x < -EPS ? -1 : 0);
}

inline Point curr(const Polygon& a, int x){
    return a[x];
}
inline Point next(const Polygon& a, int x){
    return a[(x + 1) % a.size()];
}

double dot(Point a, Point b){
    return real(conj(a) * b);
}

double cross(Point a, Point b){
    return imag(conj(a) * b);
}

enum { OUT, ON, IN };
int contains(const Polygon& P, const Point& p){
    bool in = false;
    for(int i = 0; i < P.size(); i++){
        Point a = curr(P, i) - p;
        Point b = next(P, i) - p;
        if(a.imag() > b.imag()) swap(a, b);
        if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0){
            in = !in;
        }
        if(sign(cross(a, b)) == 0 && sign(dot(a, b)) <= 0) return ON;
    }
    return in ? IN : OUT;
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        Polygon t;
        t.push_back(Point(x1, y1));
        t.push_back(Point(x2, y2));
        t.push_back(Point(x3, y3));
        if(contains(t, Point(xp, yp)) == IN){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

struct Vector2D{
	double x, y;
};

Vector2D sub_vector(const Vector2D& a, Vector2D& b) {
	Vector2D ret;
	ret.x = a.x - b.x;
	ret.y = a.y - b.y;
	return ret;
}

//?????´?????? true ?????´?????? false
bool hit(Vector2D A, Vector2D B, Vector2D C, Vector2D P) {
	Vector2D AB = sub_vector(B, A);
  Vector2D BP = sub_vector(P, B);

  Vector2D BC = sub_vector(C, B);
  Vector2D CP = sub_vector(P, C);

  Vector2D CA = sub_vector(A, C);
  Vector2D AP = sub_vector(P, A);

  double c1 = AB.x * BP.y - AB.y * BP.x;
  double c2 = BC.x * CP.y - BC.y * CP.x;
  double c3 = CA.x * AP.y - CA.y * AP.x;

  if( ( c1 > 0 && c2 > 0 && c3 > 0 ) || ( c1 < 0 && c2 < 0 && c3 < 0 ) ) {
    return false;
  }

  return true;
}

signed main(void)
{
	double x1,x2,x3,xp,y1,y2,y3,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp) {
		Vector2D a = {x1, y1}, b = {x2, y2}, c = {x3, y3}, p = {xp, yp};
		if(hit(a, b, c, p)) cout << "NO" << endl;
		else cout << "YES" << endl;
	}

	return 0;
}