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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<cmath>
using namespace std;

class Biv {
private:
  void set(Biv v) {
    x = v.x; y = v.y;
  }
public:
  string toString() {
    stringstream ss;
    ss << "(" << x << ", " << y << ")";
    return ss.str();
  }
  double x, y;
  Biv(double xx, double yy) {
    x = xx; y = yy;
  }
  Biv() {
    x = 0; y = 0;
  }
  void operator=(Biv v) { set(v); }
  Biv operator-() {
    return Biv(-x, -y);
  }
  Biv operator+(Biv v) {
    return Biv(x + v.x, y + v.y);
  }
  Biv operator-(Biv v) {
    return *this + (-v);
  }
  Biv multiple(double k) {
    return Biv(k * x, k * y);
  }
  Biv operator+=(Biv v) {
    set(*this + v); return *this;
  }
  Biv operator-=(Biv v) {
    set(*this - v); return *this;
  }
  friend ostream& operator<<(ostream& os, const Biv& v);
  double length() {
    return sqrt(x * x + y * y);
  }
  double arg() {
    if (x == 0) { return (y < 0) ? - M_PI / 2: M_PI / 2; }
    double val = atan(y / x);
    return (val > 0)? val:(M_PI + val);
  }
};

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

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

class Ttm {
private:
  void set(Ttm m) {
    a = m.a; b = m.b; c = m.c; d = m.d;
  }
public:
  double a, b, c, d;
  string toString() {
    stringstream ss;
    ss << "[" << a << "," << b << "," << c << "," << d << "]";
    return ss.str();
  }
  Ttm(double aa, double bb, double cc, double dd) {
    a = aa; b = bb; c = cc; d = dd;
  }
  Ttm() {
    a = 0; b = 0; c = 0; d = 0;
  }
  void operator=(Ttm m) { set(m); }
  Ttm operator-() {
    return Ttm(-a, -b, -c, -d);
  }
  Ttm operator+(Ttm m) {
    return Ttm(a+m.a, b+m.b, c+m.c, d+m.d);
  }
  Ttm operator-(Ttm m) {
    return *this + (-m);
  }
  Ttm operator*(Ttm m) {
    return Ttm(a*m.a+b*m.c, a*m.b+b+m.d, c*m.a+d*m.c, c*m.d+d*m.d);
  }
  Biv operator*(Biv v) {
    return Biv(a * v.x + b * v.y, c * v.x + d * v.y);
  }
  Ttm multiple(double k) {
    return Ttm(k*a, k*b, k*c, k*d);
  }
  Ttm operator+=(Ttm m) {
    set(*this + m); return *this;
  }
  Ttm operator-=(Ttm m) {
    set(*this - m); return *this;
  }
};

Ttm Rotate(double t) {
  return Ttm(cos(t), -sin(t), sin(t), cos(t));
}

bool in(Biv a, Biv b, Biv c, Biv p) {
  b -= a;
  c -= a;
  p -= a;
  
  if (cross(b,p) * cross(c,p) >= 0) {
     /*cout << "cross(" << b.toString() << "," << p.toString()
      << ") * cross(" << c.toString() << "," << p.toString() << ") > 0" << endl;*/
    return false; }
  /*cout << (c - b).toString() << endl;*/
  double t = (c - b).arg();
  /*cout << t << " "<< Rotate(-t).toString() << endl;*/
  b = Rotate(-t) * b;
  c = Rotate(-t) * c;
  p = Rotate(-t) * p;
  /*cout << "c="<<c.toString() << " ,p=" <<p.toString()<<endl;*/

  return p.y > c.y;
}


int main() {
  Biv p1, p2, p3, pp;

  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> pp.x >> pp.y) {
    bool yes = in(p1, p2, p3, pp);

    cout << ( yes ? "YES" : "NO") << endl;
  }
}

C++: #include <iostream>
#include <complex>
using namespace std;
 
typedef complex<double> Point;
 
double cross(Point a, Point b){
    return (conj(a)*b).imag();
}
 
int main(){
    Point V[3], P;
    while(true){
        double x, y;
        for(int i=0; i<3; i++){
            cin >> x >> y;
            V[i] = {x, y};
        }
        cin >> x >> y;
        P = {x, y};
         
        if(!cin)break;
         
        int sum = 0;
        for(int i=0; i<3; i++){
            sum += cross(V[(i+1)%3]-V[i], (P-V[i])) > 0;
        }
        cout << (sum==0 || sum==3? "YES": "NO") << endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <math.h>

int debug=0;

int main(void){
	double ax, ay, bx, by, cx, cy, px, py;
	double a, b, c, ap, bp, cp;
	double tmp;
	double s2, sa2, sb2, sc2;
	double s, sa, sb, sc;

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ax, &ay, &bx, &by, &cx, &cy, &px, &py) != -1){
		//ツ各ツ静シツ閉ェツづ個陳キツつウツづーツ計ツ算
		a = sqrt(fabs((bx - cx) * (bx - cx) + (by - cy) * (by- cy)));
		b = sqrt(fabs((ax - cx) * (ax - cx) + (ay - cy) * (ay- cy)));
		c = sqrt(fabs((ax - bx) * (ax - bx) + (ay - by) * (ay- by)));
		ap = sqrt(fabs((ax - px) * (ax - px) + (ay - py) * (ay- py)));
		bp = sqrt(fabs((bx - px) * (bx - px) + (by - py) * (by- py)));
		cp = sqrt(fabs((cx - px) * (cx - px) + (cy - py) * (cy- py)));

		if(debug) printf("[length]a = %.2f, b == %.2f, c = %.2f, ap = %.2f, bp = %.2f, cp = %.2f\n", a, b, c, ap, bp, cp);

		//heron
		tmp = (a + b + c) / 2;
		s2 = tmp * (tmp - a) * (tmp - b) * (tmp - c);
		s = sqrt(s2);
		if(debug) printf("s = %lf\n", s);

		tmp = (a + bp + cp) / 2;
		sa2 = tmp * (tmp - a) * (tmp - bp) * (tmp - cp);
		sa = sqrt(sa2);

		tmp = (b + ap + cp) / 2;
		sb2 = tmp * (tmp - b) * (tmp - ap) * (tmp - cp);
		sb = sqrt(sb2);

		tmp = (c + ap + bp) / 2;
		sc2 = tmp * (tmp - c) * (tmp - ap) * (tmp - bp);
		sc = sqrt(sc2);

		if(debug) printf("sa + sb + sc = %lf\n", sa + sb + sc);

		if(fabs(sa + sb + sc - s) < 0.000000001){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
	{
		complex<double> p1(x1,y1),p2(x2,y2),p3(x3,y3),pp(xp,yp);
		if ( arg((p3-p1)/(p2-p1))*arg((pp-p1)/(p2-p1))>0 &&
			 arg((p1-p2)/(p3-p2))*arg((pp-p2)/(p3-p2))>0 &&
			 arg((p2-p3)/(p1-p3))*arg((pp-p3)/(p1-p3))>0 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
			 
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
struct vect{
  double x,y;
};
double Sc(vect a,vect b,vect c){
  double S;
  b.x = b.x - a.x;
  b.y = b.y - a.y;
  c.x = c.x - a.x;
  c.y = c.y - a.y;
  S = b.x * c.y - b.y * c.x;
  if(S >= 0){
    return S/2;} else if(S < 0){
    return -S/2;
  }
}
int main(){
  vect a,b,c,p;
  int n;
  cin >> n;
  
  while(cin >> a.x >> a.y  >> b.x >> b.y >>c.x >>c.y >> p.x >> p.y){
    if(Sc(a,b,p) +Sc(a,p,c) +Sc(p,b,c) == Sc (a,b,c)){
      cout << "YES" << endl;
    }else {cout << "NO" << endl;}
    
  }
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<stdio.h>
using namespace std;

int main()
{
 double x1, y1, x2, y2, x3, y3, xp, yp, a, b, c;
 while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
 {
	 a = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
     b = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
     c = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
	 if((a>0&&b>0&&c>0)||(a<0&&b<0&&c<0))
		 cout<<"YES"<<endl;
	 else
		 cout<<"NO"<<endl;
 }
 return 0;
}

C++: #include <iostream>

using namespace std;

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 pax = x1 - xp, pay = y1 - yp, pbx = x2 - xp, pby = y2 - yp, pcx = x3 - xp, pcy = y3 - yp;
        double n1 = pax * pby - pay * pbx, n2 = pbx * pcy - pby * pcx, n3 = pcx * pay - pcy * pax;
        if((n1 <= 0.0 && n2 <= 0.0 && n3 <= 0.0) || (n1 > 0.0 && n2 > 0.0 && n3 > 0.0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}