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++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
double x[4], y[4];

double calc(int i, int j, int k){
  return 0.5 * abs((x[j] - x[i]) * (y[k] - x[i]) - (x[k] - x[i]) * (y[j] - y[i]));
}

int main(int argc, char const* argv[])
{
  while(cin >> x[0]){
    cin >> y[0];
    FOR(i, 1, 4){
      cin >> x[i] >> y[i];
    }
    double area = calc(0, 1, 2);
    double tmp = calc(0, 1, 3) + calc(0, 2, 3) + calc(1, 2, 3);
    if(abs(area - tmp) < EPS){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
	return 0;
}

C++: #include <iostream>

using namespace std;

template <typename T>
struct Vector2
{
// variable
public:
	T x;
	T y;

// structor
public:
	Vector2(const Vector2& other) :
		x(other.x),
		y(other.y)
	{

	}

	Vector2(T x = 0, T y = 0) :
		x(x),
		y(y)
	{

	}

// operator
public:
	Vector2 operator-(const Vector2<T>& rhs) const
	{
		return Vector2(x - rhs.x, y - rhs.y);
	}

	Vector2& operator=(const Vector2<T>& rhs)
	{
		x = rhs.x;
		y = rhs.y;
		return *this;
	}
};

template <typename T>
ostream& operator<< (ostream& stream, const Vector2<T>& rhs)
{
	stream << '(' << rhs.x << ", " << rhs.y << ')';
	return stream;
}

template <typename T>
istream& operator>> (istream& stream, Vector2<T>& rhs)
{
	stream >> rhs.x >> rhs.y;
	return stream;
}

template <typename T>
int relation(const Vector2<T>& p1, const Vector2<T>& p2)
{
	T product = p1.x * p2.y - p1.y * p2.x;
		
	return
		product == 0 ? 0 : (product > 0 ? 1 : -1);
}

int main()
{
	Vector2<double> a, b, c, p;
	while(cin >> a >> b >> c >> p)
	{
		if( relation(b-a, b-p) > 0 || relation(c-b, b-p) > 0 || relation(a-c, a-p) > 0 )
			cout << "NO" << endl;
		else
			cout << "YES" << endl;
	}
	return 0;
}

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

double dot_product(xy_t a,xy_t b) {
  return (conj(a)*b).real();
}

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

xy_t projection(xy_t p,xy_t b) {
  return b * dot_product(p,b)/norm(b);
}

xy_t A[4];
double re,im;
double S[3];

int main() {
  while(true) {
    for (int i=0;i<4;i++) {
      if (scanf("%lf%lf",&re,&im) == EOF) {
	goto STOP;
      }
      xy_t P(re,im);
      A[i] = P;
    }
    for (int i=0;i<3;i++) {
      S[i] = cross_product(A[i%3]-A[3],A[(i+1)%3]-A[3]);
    }
    if ((S[0] > 0 && S[1] > 0 && S[2] > 0) || (S[0] < 0 && S[1] < 0 && S[2] < 0)) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
 STOP: return 0;
}

C++: #include <iostream>

double cross(double ax, double ay, double bx, double by)
{
    return ax*by - ay*bx;
}

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

    /* A(x1, y1)
     * B(x2, y2)
     * C(x3, y3)
     * P(xp, yp)
     * */
    double x1,y1,x2,y2,x3,y3,xp,yp;
    while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        if (cross(x2-x1, y2-y1, xp-x1, yp-y1) > 0 &&
            cross(x3-x2, y3-y2, xp-x2, yp-y2) > 0 &&
            cross(x1-x3, y1-y3, xp-x3, yp-y3) > 0)
            std::cout << "YES" << std::endl;
        else
            std::cout << "NO" << std::endl;
    }
}

C++: #include <iostream>

struct Vec2D{
				double x,y;
};

Vec2D vector(double x1,double y1,double x2,double y2){
				Vec2D vec;
				vec.x = x2 -x1;
				vec.y = y2 -y1;
				return vec;
}

double outerProduct(Vec2D a,Vec2D b){
				double crossProduct = a.x * b.y - a.y * b.x;
				return crossProduct;
}

int main(int argc, char *argv[])
{
	double x1,x2,x3,y1,y2,y3,x,y;

	while(std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y){

		Vec2D BA = vector(x2,y2,x1,y1);
		Vec2D CB = vector(x3,y3,x2,y2);
		Vec2D AC = vector(x1,y1,x3,y3);


		Vec2D BP = vector(x2,y2,x,y);
		Vec2D CP = vector(x3,y3,x,y);
		Vec2D AP = vector(x1,y1,x,y);

		double a,b,c;

		a = outerProduct(BA,BP);
		b = outerProduct(CB,CP);
		c = outerProduct(AC,AP);



		if(a<0 && b<0 && c<0){
					std::cout << "YES" << std::endl;
		}else{
					std::cout << "NO" << std::endl;
		}

	}
}

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

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

using namespace std;

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

template<class T> T lov_yet(T t){
    if(t) return t poi
    else return 0 poi
}

template<class T> T gcd(T a, T b){
    if(b) return gcd(b, a % b) poi
    else return a poi
}

pair<double, double> solve_linear(double a1, double b1, double c1, double a2, double b2, double c2){
    return make_pair(lov_yet((b1 * c2 - b2 * c1) / (b1 * a2 - b2 * a1)), lov_yet((a1 * c2 - a2 * c1) / (a1 * b2 - b1 * a2))) poi
}

double distance(const pair<double, double>& p){
    return lov_yet(sqrt(p.first * p.first + p.second * p.second)) poi
}
double distance(const pair<double, double>& a, const pair<double, double>& b){
    return distance(make_pair(a.first - b.first, a.second - b.second)) poi
}

double inner_product(const pair<double, double>& a, const pair<double, double>& b){
    return lov_yet(a.first * b.first + a.second * b.second) poi
}

double outer_product_z(const pair<double, double>& a, const pair<double, double>& b){
    return lov_yet(a.first * b.second - b.first * a.second) poi
}

int main(){
    double     x1, y1, x2, y2, x3, y3, xp, yp poi

    while(read(x1, y1, x2, y2, x3, y3, xp, yp)){
        double a = outer_product_z(make_pair(x2 - x1, y2 - y1), make_pair(xp - x1, yp - y1)),
               b = outer_product_z(make_pair(x3 - x2, y3 - y2), make_pair(xp - x2, yp - y2)),
               c = outer_product_z(make_pair(x1 - x3, y1 - y3), make_pair(xp - x3, yp - y3)) poi
        if(a * b >= 0 && b * c >= 0 && c * a >= 0)
            cout << "YES" poipoi poi
        else
            cout << "NO" poipoi poi
    }

    return 0 poi
}