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>
using namespace std;

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

int main(void){
    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 r1=relative(x1-x3, y1-y3, xp-x1, yp-y1);
        double r2=relative(x2-x1, y2-y1, xp-x2, yp-y2);
        double r3=relative(x3-x2, y3-y2, xp-x3, yp-y3);
        if((r1<0&&r2<0&&r3<0) || (r1>0&&r2>0&&r3>0)) cout << "YES" <<"\n";
        else cout << "NO" << "\n";
    }
}

C++: #include <iostream>
#include <math.h>
using namespace std;
double helon(double x1,double y1,double x2,double y2,double x3,double y3){
	double a,b,c,s,area;
	a = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	b = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
	c = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
	s = (a+b+c)/2;
	area = sqrt(s*(s-a)*(s-b)*(s-c));
	return area;
}

int main(){
	double e=0.0000001;
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double s,s1,s2,s3;
		s = helon(x1,y1,x2,y2,x3,y3);
		s1 = helon(xp,yp,x1,y1,x2,y2);
		s2 = helon(xp,yp,x2,y2,x3,y3);
		s3 = helon(xp,yp,x3,y3,x1,y1);
		cout<<s<<" "<<s1<<" "<<s2<<" "<<s3<<endl;
		if(fabs(s1)<e || fabs(s2)<e || fabs(s3)<e)
			cout<<"NO"<<endl;
		else if(fabs(s-(s1+s2+s3))<e)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
	}
	return 0;
}

C++: #if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
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);
}

int main() {
  double x[4], y[4];
  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]);
    double a1 = cross_product(a - p, b - p), a2 = cross_product(b - p, c - p), a3 = cross_product(c - p, a - p);
    bool ok = ((a1*a2 > 0.0) && (a2*a3 > 0.0) && (a3*a1 > 0.0));
    cout << (ok ? "YES" : "NO") << endl;
  }
}

C++: import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		while (true)
		{
			double x1, y1, x2, y2, x3, y3, xp, yp;
			try
			{
				x1 = sc.nextDouble();
				y1 = sc.nextDouble();
				x2 = sc.nextDouble();
				y2 = sc.nextDouble();
				x3 = sc.nextDouble();
				y3 = sc.nextDouble();
				xp = sc.nextDouble();
				yp = sc.nextDouble();
			}
			catch (Exception e)
			{
				break;
			}
			
			if (!((f(x1, y1, x2, y2, x3) < y3 && f(x1, y1, x2, y2, xp) < yp)
				|| (f(x1, y1, x2, y2, x3) > y3 && f(x1, y1, x2, y2, xp) > yp)
			)) {
				System.out.println("NO");
				continue;
			}
			if (!((f(x2, y2, x3, y3, x1) < y1 && f(x2, y2, x3, y3, xp) < yp)
				|| (f(x2, y2, x3, y3, x1) > y1 && f(x2, y2, x3, y3, xp) > yp)
			)) {
				System.out.println("NO");
				continue;
			}
			if (!((f(x3, y3, x1, y1, x2) < y2 && f(x3, y3, x1, y1, xp) < yp)
				|| (f(x3, y3, x1, y1, x2) > y2 && f(x3, y3, x1, y1, xp) > yp)
			)) {
				System.out.println("NO");
				continue;
			}
			System.out.println("YES");
		}
	}
	private static double f(double x1, double y1, double x2, double y2, double x)
	{
		return (y1 - y2) / (x1 - x2) * (x - x1) + y1;
	}
}

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

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

using namespace std;
#define EPS (1e-10)
#define ABS(x) ((x)<0?-(x):(x))
struct L{
    L(double xa, double ya, double xb, double yb){
	x1 = xa;
	y1 = ya;
	x2 = xb;
	y2 = yb;
	if(xa-xb == 0){
	    a = 1;
	    b = 0;
	    c = -xa;
	}
	else {
	    a = (ya-yb);
	    b = (xb-xa);
	    c = -(a*xa + b*ya);
	}
    };
    double f(double x, double y){
	return a*x + b*y + c;
    }
    double a, b, c, x1, x2, y1, y2;//0 = ax + by + c [x1, x2]
};

bool cross(L a, L b){
    return (a.f(b.x1, b.y1) * a.f(b.x2, b.y2) < 0+EPS && 
	    b.f(a.x1, a.y1) * b.f(a.x2, a.y2) < 0+EPS);
}

double x1, y1, x2, y2, x3, y3, xp, yp;

int main(){
    while(cin){
	cin >> x1 >> y1 >> x2 >> y2>> x3 >> y3 >> xp >> yp;
	L a = L(x1, y1, x2, y2);
	L b = L(x1, y1, x3, y3);
	L c = L(x2, y2, x3, y3);
	L p = L(xp, yp, 0, 103.141592);
	int res = 0;
	if(cross(a,p))res++;
	if(cross(b,p))res++;
	if(cross(c,p))res++;
	if(res % 2 == 0)cout << "NO" <<  endl;
	else cout << "YES"<<endl;
    }
    return 0;
}

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

typedef complex<double> P;
const double precision = 1e-10;
bool eql(double a, double b) { return abs(a - b) < precision; }
double cross(P a, P b) { return a.real()*b.imag() - b.real()*a.imag(); }
bool leftp(P start, P end, P p) { return cross(end-start, p-start) > -precision; }
bool intrianglep(P a, P b, P c, P p) {
  return (leftp(b, a, p) && leftp(c, b, p) && leftp(a, c, p))
         || (leftp(b, c, a) && leftp(a, b, c) && leftp(c, a, p));
}

int main(int argc, char **argv)
{
  P a, b, c, x;
  double p, q, r, s, t, u, v, w;

  for (;;) {
    cin >> p >> q >> r >> s >> t >> u >> v >> w;
    a = P(p, q);
    b = P(r, s);
    c = P(t, u);
    x = P(v, w);
    if (cin.eof())
      break;

    if (intrianglep(a, b, c, x))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

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

double Area(double* x1, double* y1, double* x2, double* y2){
  return (*x1 * *y2 - *x2 * *y1)/2.0;
}

double Segitiga(double* a, double * b, double* c, double* d, double* e, double* f){
  return abs (Area(a,b,c,d) + Area(c,d,e,f) + Area(e,f,a,b));
}

int main(){
  double a, b, c, d, e, f, g, h, ta, tb;
  cin >> a >> b >> c >> d >> e >> f >> g >> h;
  ta = Segitiga(&a, &b, &c, &d, &e, &f);
  tb = Segitiga(&a, &b, &c, &d, &g, &h) + Segitiga(&a, &b, &e, &f, &g, &h) + Segitiga(&c, &d, &e, &f, &g, &h);

  if(tb-ta > 1e-8)
    cout << "NO\n";
  else
    cout << "YES\n";
  
return 0;
}