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>
using namespace std;
#include <math.h>

int main()
{
	double x1, y1, x2, y2, x3, y3, x, y;
	double ax, ay, bx, by;
	double z1, z2, z3; // ベクトルAとベクトルBの外積のz成分
	
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y) {
		ax = x2 - x1;
		ay = y2 - y1;
		bx = x - x1;
		by = y - y1;
		z1 = ax * by - ay * bx;
		
		ax = x3 - x2;
		ay = y3 - y2;
		bx = x - x2;
		by = y - y2;
		z2 = ax * by - ay * bx;
		
		ax = x1 - x3;
		ay = y1 - y3;
		bx = x - x3;
		by = y - y3;
		z3 = ax * by - ay * bx;
		
		if ( ( (z1 > 0) && (z2 > 0) && (z3 > 0) ) || ( (z1 < 0) && (z2 < 0) && (z3 < 0) ) )
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3]){
        double a[3],b[3],c[3],d[3];
        for(int i=0;i<3;i++){
            a[i]=x[(i+1)%3]-x[i];
            b[i]=y[(i+1)%3]-y[i];
        }
        for(int i=0;i<3;i++){
            c[i]=x[3]-x[i];
            d[i]=y[3]-y[i];
        }
        int suc=1;
        for(int i=0;i<3;i++){
            
            if((a[i]*b[(i+1)%3]-a[(i+1)%3]*b[i])*(a[i]*d[(i+1)%3]-c[(i+1)%3]*b[i])<0){
                suc=0;
                break;
            }
        }
        if(suc==0)
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }

    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
using namespace std;
#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS)
class Point{
public:
  double x,y;
  Point(double x = 0, double y = 0):x(x), y(y) {}
  Point operator + (Point p){
    return Point(x+p.x,y+p.y);
  }
  Point operator - (Point p){
    return Point(x-p.x,y-p.y);
  }
  Point operator * (double k){
    return Point(x*k,y*k);
  }
  Point operator / (double k){
    return Point(x/k,y/k);
  }
  bool operator == (const Point &p) const{
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};
typedef Point Vector;
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
  return a.x * b.x + a.y * b.y;
}
double cross(Vector a,Vector b){
  return a.x * b.y - a.y * b.x;
}
// IN 2 ON 1 OUT 0
int contains(Polygon g,Point p){
  int n=g.size();
  bool x = false;
  for(int i=0;i<n;i++){
    Point a = g[i] - p, b = g[(i+1)%n] - p;
    if(fabs(cross(a,b))<EPS && dot(a,b) < EPS ) return 1;
    if(a.y > b.y ) swap(a,b);
    if(a.y<EPS && EPS < b.y && cross(a,b) > EPS) x = !x;
  }
  return ( x ? 2:0);
}
int main(){
  Point a,b,c,d;
  while(cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y){
    Polygon g;
    g.push_back(a);g.push_back(b);g.push_back(c);
    if(contains(g,d)==2) cout << "YES" <<endl;
    else cout << "NO" <<endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#define STRMAX 200
#define PNUM 3 

using namespace std;

class Point{
  public:
    double x, y;
  public:
    bool isLeft( Point *p, Point *q );
};
enum State{
  NONE,
  LEFT,
  RIGHT
};
bool Point::isLeft( Point *p, Point *q ){
  double x1 = p->x - this->x;
  double x2 = q->x - this->x;
  double y1 = p->y - this->y;
  double y2 = q->y - this->y;
  return (x1 * y2 - x2 * y1 > 0) ? true : false;
}

void c2s( char str[] ){
  for( int i = 0; str[ i ] != '\0'; i++ ){
    str[ i ] = ( ( str[ i ] == ',' ) ? ' ' : str[ i ] );
  }
}

int main(){
  char str[ STRMAX ];
  Point *p[ PNUM ] = { NULL, NULL, NULL };
  Point *pp;
  while( 1 ){
      for( int i = 0; i < PNUM; i++ ){
        if( p[ i ] == NULL ){  delete p[ i ]; }
        p[ i ] = new Point();
      }
      if( pp == NULL ){ delete pp; }
      pp = new Point();
      if( 
          scanf(
            "%lf%lf%lf%lf%lf%lf%lf%lf", 
            &(p[ 0 ]->x), 
            &(p[ 0 ]->y), 
            &(p[ 1 ]->x), 
            &(p[ 1 ]->y), 
            &(p[ 2 ]->x), 
            &(p[ 2 ]->y),
            &(pp->x), &(pp->y)
          ) == EOF
      ){ break; }
     State state = NONE;
     bool ok = true;
     for( int i = 0; i < PNUM; i++ ){
        State s = LEFT;
        if( !pp->isLeft( p[i%PNUM], p[(i+1)%PNUM] ) ){
          s = RIGHT;
        }
        if( state != NONE && state != s ){
          ok = false;
          break;
        }
        state = s;
     }
     puts( ok ? "YES" : "NO" );
  }

  return EXIT_SUCCESS;
}

C++: #include <bits/stdc++.h>
#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>
#include <cmath>
#include <cstdlib>
using namespace std;

typedef struct{
    double x;
    double y;
}vec;
vec makeVec(vec p,vec q){
    vec r;
    r.x=q.x-p.x;
    r.y=q.y-p.y;
    return r;
}

double crossZe(vec p,vec q){
    return (p.x*q.y-p.y*q.x)/fabs(p.x*q.y-p.y*q.x);
}

bool Tri(vec p[3],vec q[3]){
    double c,d;
    c = crossZe(p[0],q[0]);
    if(c==0) return true;
    for(int i=0;i<2;i++){
        d=crossZe(p[i],q[i]);
        if(fabs(d)==0.0) return true;
        if(c!=d) return false;
    }
    return true;
}
int main(int argc, const char * argv[]) {
    vec p[3],q,r[3],rq[3];
    while(cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y){
        cin >> q.x >> q.y;
        r[0]=makeVec(p[0],p[1]);
        r[1]=makeVec(p[1],p[2]);
        r[2]=makeVec(p[2],p[0]);
        rq[0]=makeVec(q,p[1]);
        rq[1]=makeVec(q,p[2]);
        rq[2]=makeVec(q,p[0]);
        if(Tri(r,rq)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}