Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

C++: #include<iostream>
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;

long double calc(double x1,double y1,double x2,double y2,double x,double y){
	return (x1-x2)*(y-y1)+(y1-y2)*(x1-x);
}

bool isCross(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
	if( calc(x1,y1,x2,y2,x3,y3) * calc(x1,y1,x2,y2,x4,y4)<0 )
		if( calc(x3,y3,x4,y4,x1,y1) * calc(x3,y3,x4,y4,x2,y2)<0 )
			return true;
	return false;
} 


int main(){
	while(1){
		double x[3],y[3],xp,yp;

		rep(i,3)cin>>x[i]>>y[i];
		if(!(cin>>xp>>yp))break;

		bool cross=false;
		rep(i,3){
			if( isCross(x[i%3],y[i%3],x[(i+1)%3],y[(i+1)%3],x[(i+2)%3],y[(i+2)%3],xp,yp) )
				cross=true;
		}
		if(cross==true){
			cout<<"NO"<<endl;
		}else{
			cout<<"YES"<<endl;
		}
	}
	return 0;
}

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

int main() {
	xy a, b, c, p;
	while (cin 
		>> a.real() >> a.imag()
		>> b.real() >> b.imag()
		>> c.real() >> c.imag()
		>> p.real() >> p.imag()) 
	{
		double d, e, f;
		d = (conj(a - p)*(b - p)).imag();
		e = (conj(b - p)*(c - p)).imag();
		f = (conj(c - p)*(a - p)).imag();
		if ((d < 0 && e < 0 && f < 0) || (d > 0 && e > 0 && f > 0))	cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#define INF 100000000
using namespace std;
typedef double d;
bool isintersect(d x1,d x2, d y1 , d y2 , d px, d py , d qx, d qy)
{
  return ((py-y1)*(x1-x2) + (px - x1)*(y1-y2))*((qy-y1)*(x1-x2) + (qx - x1)*(y1-y2)) > 0;
}
int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while( cin >>  x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp )
    {
      if( isintersect(x1,x2,y1,y2,xp,yp,x3,y3) &&
	  isintersect(x1,x3,y1,y3,xp,yp,x2,y2) &&
	  isintersect(x3,x2,y3,y2,xp,yp,x1,y1))cout << "YES" << endl;
      else cout << "NO" << endl;
    }
  return 0;
}

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

using namespace std;

#define EPS 1e-10

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}
    Point operator - (const Point &p) const {  return Point(x - p.x, y - p.y); }
};

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

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

double norm(const Point &p){
    return dot(p, p);
}

#define COUNTER_CLOCKWISE +1
#define CLOCKWISE         -1
#define ONLINE_BACK       +2
#define ONLINE_FRONT      -2
#define ON_SEGMENT        +0
typedef Point Vector;

int ccw(const Point &p0, const Point &p1, const Point &p2)
{
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS)  return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS) return CLOCKWISE;
    if (dot(a, b) < -EPS)   return ONLINE_BACK;
    if (norm(a) < norm(b))  return ONLINE_FRONT;
    return ON_SEGMENT; 
}

istream &operator >> (istream &is, Point &p)
{
    return is >> p.x >> p.y;
}

bool in_triangle(Point *p, Point &xp)
{
    for (int i = 0; i < 3; i++) {
        if (ccw(xp, p[i], p[(i+1)%3]) != COUNTER_CLOCKWISE) {
            return 0;
        }
    }
    return 1;
}

int main()
{
    Point p[3], xp;
    while (cin >> p[0] >> p[1] >> p[2] >> xp) {
        cout << (in_triangle(p, xp) ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;

struct Pos{
	double x,y;
};

Pos VSub(Pos pos1,Pos pos2){
	pos1.x -= pos2.x;
	pos1.y -= pos2.y;
	return pos1;
}
int main(){
	Pos point[4];	//point[3]:ten
	char *c[200];
	int i,cor = 0;
	while(cin >> point[0].x){
		cin >> point[0].y;
		for(i = 1;i < 4;i++){
			cin >> point[i].x >> point[i].y;
		}
		Pos v[6];
		double at[6];
		for(i = 0;i < 3;i++){
			v[i] = VSub(point[(i+1)%3],point[i]);
			at[i] = atan2(v[i].y,v[i].x);
			v[i+3] = VSub(point[3],point[i]);
			at[i+3] = atan2(v[i+3].y,v[i+3].x);
		}
		if(at[0] > at[3] && at[1] > at[4] && at[2] > at[5])
			c[cor] = "YES";
		else if(at[0] < at[3] && at[1] < at[4] && at[2] < at[5])
			c[cor] = "YES";
		else
			c[cor] = "NO";
		cor++;
	}
	for(i = 0;i < cor;i++)
		cout << c[i] << endl;
}

C++: #include <iostream>
#include <iomanip>
#include <math.h>
#include <utility>
#include <cstdlib>
using namespace std;

int main(){
	double x[3],y[3],xp,yp;
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
		//??????
		double gaiseki[3];
		for(int i=0;i<3;i++){
			double vx,vy,vxp,vyp;
			vx = x[(i+1)%3]-x[i];
			vy = y[(i+1)%3]-y[i];
			vxp = xp-x[i];
			vyp = yp-y[i];
			gaiseki[i] = vx*vyp-vy*vxp;
		}
		if(gaiseki[0]>0&&gaiseki[1]>0&&gaiseki[2]>0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: //#include <bits/stdc++.h>
#include <complex>
#include <cmath>
#include <iostream>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;
typedef complex<double> xy_t;

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

double x[4],y[4];

int main(){
	while(true){
		rep(i,0,4) 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]);
		int pab,pbc,pca;
		bool ok=0;
		pab=cross_product(a-p,b-p);
		pbc=cross_product(b-p,c-p);
		pca=cross_product(c-p,a-p);
		if((pab>0 && pbc>0 && pca>0)||(pab<0 && pbc<0 && pca<0)) ok=1;
		cout<<(ok?"YES":"NO")<<endl;
	}
}

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) == 0 || Sc(a,p,c)== 0|| Sc(p,b,c)==0 ){
     cout << "NO"<< endl;    } else  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 <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>

using namespace std;

typedef complex<double> P;

double dot(P p1,P p2){
	return p1.real() * p2.imag() - p1.imag() * p2.real();
}


int main(){

	double x1,x2,x3,y1,y2,y3;
	double xp,yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		P  p1(x1,y1),p2(x2,y2),p3(x3,y3),po(xp,yp);
		bool f = true;
		if( dot(p2-p1,p3-p1) * dot(p2-p1,po-p1) < 0)
			f = false;
		else if(dot(p3-p1,p2-p1) * dot(p3-p1,po-p1) < 0)
			f = false;
		else if(dot(p2-p3,p1-p3) * dot(p2-p3,po-p3) < 0)
			f = false;

		cout << (f ? "YES" : "NO") << endl;

	}

	return 0;
}