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 <iostream>

using namespace std;

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	double s,t,delta;
	while(cin >> x1 >> y1>> x2>> y2>> x3>> y3>> xp>> yp){
		x2 -= x1;
		y2 -= y1;
		x3 -= x1;
		y3 -= y1;
		xp -= x1;
		yp -= y1;
//		cout << x1 << y1<< x2<< y2<< x3<< y3<< xp<< yp;
		delta = x2*y3 - x3*y2;
//		cout << delta << endl;
		s= (xp*y3-yp*x3)/delta;
		t= (-xp*y2+yp*x2)/delta;
//		cout << s << " " << t << endl;
		if(s > 0 && t > 0 && s+t<1){
			cout << "YES" <<endl;
		}
		else{
			cout << "NO" << endl;
		}
	}


}

C++: #include<bits/stdc++.h>
using namespace std;

double x[3],y[3],xp,yp;
double EPS=1e-8;
int main(){
    while(scanf("%lf%lf",&x[0],&y[0])!=EOF){
        for(int i=1;i<3;i++)scanf("%lf%lf",&x[i],&y[i]);
        scanf("%lf%lf",&xp,&yp);

        double S=fabs((x[1]-x[0])*(y[2]-y[0])-(x[2]-x[0])*(y[1]-y[0]))/2;

        for(int i=0;i<3;i++){
            S-=fabs((x[i]-xp)*(y[(i+1)%3]-yp)-(x[(i+1)%3]-xp)*(y[i]-yp))/2;
        }

        if(fabs(S)<EPS)puts("YES");
        else puts("NO");
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

struct Point {
    double x, y;
};

double len(Point p1, Point p2) {
    return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y));
}

double area(Point *points) {
    double a = len(points[0], points[1]);
    double b = len(points[1], points[2]);
    double c = len(points[2], points[0]);
    double s = (a + b + c) / 2;
    return sqrt(s*(s - a)*(s - b)*(s - c));
}

int is_in(Point *points, Point search) {
    double src = area(points);
    double a, b, c;
    
    swap(points[0], search);
    a = area(points);
    swap(points[0], search);

    swap(points[1], search);
    b = area(points);
    swap(points[1], search);

    swap(points[2], search);
    c = area(points);
    swap(points[2], search);

    if (src - 1e-5 < a + b + c && a + b + c < src + 1e-5) {
        return 1;
    }
    else {
        return 0;
    }
}

int main() {
    while (1) {
        Point points[3];
        Point search;

        for (int i = 0; i < 3; i++) {
            cin >> points[i].x >> points[i].y;
        }
        if (cin >> search.x >> search.y) {
            return 0;
        }
    
        if (is_in(points, search) == 1) {
            cout << "YES\n";
        }
        else {
            cout << "NO\n";
        }
    }
    
    return 0;
}

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

int main(){
	double a,b,c,d,e,f,p,q;
	bool j;
	while( scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f,&p,&q) != EOF ){
		if( (q==(b-d)/(a-c)*p-(a*d-b*c)/(c-a))||
			(q==(d-f)/(c-e)*p-(c*f-d*e)/(e-c))||
			(q==(f-b)/(e-a)*p-(e*b-a*f)/(a-e))){
				printf("NO\n");
		}
		else{
			j = true;
			if(a==c){
				if(!(p>a==e>a))j=false;
			}
			else{
				if( !( (q>(b-d)/(a-c)*p-(a*d-b*c)/(c-a))==(f>(b-d)/(a-c)*e-(a*d-b*c)/(c-a)) ) )j=false;
			}
			if(c==e){
				if(!(p>c==a>c))j=false;
			}
			else{
				if(!( (q>(d-f)/(c-e)*p-(c*f-d*e)/(e-c))==(b>(d-f)/(c-e)*a-(c*f-d*e)/(e-c)) ))j=false;
			}
			if(e==a){
				if(!(p>e==c>e))j=false;
			}
			else{
				if(!( (q>(f-b)/(e-a)*p-(e*b-a*e)/(a-e))==(d>(f-b)/(e-a)*b-(e*b-a*f)/(a-e)) ))j=false;
			}
			if(j){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

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;
		}

	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }
  inline double det(Point p){ return (conj(*this) * p).imag(); }
};

namespace std
{
  bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

int ccw(Point a, Point b, Point c)
{
  b -= a;
  c -= a;
  if(b.det(c) > 0.0)    return  1;
  if(b.det(c) < 0.0)    return -1;
  if(b.dot(c) < 0.0)    return  2;
  if(norm(b) < norm(c)) return -2;
  return 0.0;
}

double x[3], y[3];
double px, py;

int main()
{
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> px >> py){
    Point A = Point(x[0], y[0]);
    Point B = Point(x[1], y[1]);
    Point C = Point(x[2], y[2]);
    Point P = Point(px, py);
    Point AB = B - A, BC = C - B, CA = A - C;
    Point AP = P - A, BP = P - B, CP = P - C;

    bool ok = false;
    if(AB.det(BP) > 0 && BC.det(CP) > 0 && CA.det(AP) > 0) ok = true;
    if(AB.det(BP) < 0 && BC.det(CP) < 0 && CA.det(AP) < 0) ok = true;

    puts(ok ? "YES" : "NO");
  }

  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	double a, b, c;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		a = (x2 - x1)*(yp - y1) - (xp - x1)*(y2 - y1);
		b = (x3 - x2)*(yp - y2) - (xp - x2)*(y3 - y2);
		c = (x1 - x3)*(yp - y3) - (xp - x3)*(y1 - y3);
		if((a > 0 && b > 0 && c > 0) || (a < 0 && b < 0 && c < 0)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}