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 <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(true){
	REP(i,4) {
	    cin >> x[i];
	    if(cin.eof()) return 0;
	    cin >> y[i];
	}
	double s,t;
	bool flg = false;
	REP(i,1e6){
	    s = ((double)i/1e6);
	    t = (double)1 - s;
	    double x1 = s * (x[2] - x[0]) + t * ( x[1] - x[0]);
	    double y1 = s * (y[2] - y[0]) + t * ( y[1] - y[0]);
	    double x2 = x[3] - x[0];
	    double y2 = y[3] - y[0];
	    double dotpro = (  (  (x1 * x2 + y1 * y2 )*(x1 * x2 + y1 * y2 ) )  /( (x1*x1 + y1*y1)*(x2*x2 + y2*y2))); 
	    //cout << dotpro << endl;
	    if(  1 - dotpro  <= 1e-3  ){
		    flg = true;
		    break;
	    }
	}
	if(flg) cout << "YES" << endl;
	else cout << "NO" << endl;

    }

    return 0;
}

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

double xa, ya, xb, yb, xc, yc, xp, yp, x, y, z;
double m(double a, double b, double c, double d) {
	return a*d - b*c;
}
int main() {
	while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &xa, &ya, &xb, &yb, &xc, &yc, &xp, &yp) != EOF) {
		x = m(xp-xa, yp-ya, xb-xa, yb-ya);
		y = m(xp-xb, yp-yb, xc-xb, yc-yb);
		z = m(xp-xc, yp-yc, xa-xc, ya-yc);
		if ((x<0 && y<0 && z<0) || (x>0 && y>0 && z>0)) printf("YES\n");
		else printf("NO\n");
	}
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define NITENKAN(a, b) sqrt(((a.first - b.first) * (a.first - b.first)) + ((a.second - b.second) * (a.second - b.second)))
using namespace std;

bool checkTriIn(pair<double, double> vA, pair<double, double> vB, pair<double, double> vC, pair<double, double> P){
	pair<double, double> center((vA.first + vB.first + vC.first / 3), (vA.second + vB.second + vC.second / 3));

	vector<pair<double, double> > triangleLine;
	vector<pair<double, double> > centerToVertex;
	pair<double, double> vAvB(vB.first - vA.first, vB.second - vA.second);
	pair<double, double> vBvC(vC.first - vB.first, vC.second - vB.second);
	pair<double, double> vCvA(vA.first - vC.first, vA.second - vC.second);

	triangleLine.push_back(vAvB);
	triangleLine.push_back(vBvC);
	triangleLine.push_back(vCvA);

	pair<double, double> centerP(P.first - center.first, P.second - center.second);
	pair<double, double> centerA(vA.first - center.first, vA.second - center.second);
	pair<double, double> centerB(vB.first - center.first, vB.second - center.second);
	pair<double, double> centerC(vC.first - center.first, vC.second - center.second);

	centerToVertex.push_back(centerA);
	centerToVertex.push_back(centerB);
	centerToVertex.push_back(centerC);

	for(int i = 0; i < 3; i++){
		double cross = triangleLine[i].first * centerP.second - centerP.first * triangleLine[i].second;
		if(cross == 0) continue;
		double r = triangleLine[i].first * centerToVertex[i].second - centerToVertex[i].first * triangleLine[i].second;
		r /= cross;
		double s = centerP.first * centerToVertex[i].second - centerToVertex[i].first * centerP.second;
		s /= cross;

		if(r >= 0 && r <= 1 && s >= 0 && s <= 1){
			return true;
		}
	}
	return false;
}

int main(){
	pair<double, double> vA, vB, vC, P;

	while(cin >> vA.first >> vA.second >> vB.first >> vB.second >> vC.first >> vC.second >> P.first >> P.second){
		if(checkTriIn(vA, vB, vC, P)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

C++: #include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
signed main(void){
    double x[4],y[4],x0,y0;
    while(cin>>x[0]>>y[0]){
    for(int i=1;i<3;i++)
        cin>>x[i]>>y[i];
    cin>>x0>>y0;
    x[3]=x[0],y[3]=y[0];
    int l=0,r=0;
    for(int i=0;i<3;i++){
        double ax=x[i+1]-x[i],ay=y[i+1]-y[i];
        double px=x[i]-x0,py=y[i]-y0;
        if(ax*py-ay*px<0)
            r=1;
        else
            l=1;
    }
    cout<<(l!=r ? "YES" : "NO")<<endl;
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
class Vector {
public:
  double x;
  double y;
  Vector(double xx=0,double yy=0) {x=xx;y=yy;}
  Vector operator+(Vector p) ;
  Vector operator-(Vector p);
};
Vector Vector::operator+(Vector p) {
  Vector tmp;
  tmp.x=x+p.x;
  tmp.y=y+p.y;
  return tmp;
}
Vector Vector::operator-(Vector p) {
  Vector tmp;
  tmp.x=x+p.x;
  tmp.y=y+p.y;
  return tmp;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P);

int main() {
  double x1,x2,x3,y1,y2,y3,x,y;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y) {
    Vector A(x1,y1);
    Vector B(x2,y2);
    Vector C(x3,y3);
    Vector P(x,y);
    if(check_hit(A,B,C,P))
      cout<<"YES\n";
    else
      cout<<"NO\n"; 
   }
  return 0;
}
bool check_hit(Vector A,Vector B,Vector C,Vector P) {
  Vector AB=B-A;
  Vector BC=C-B;
  Vector CA=A-C;
  Vector AP=P-A;
  Vector BP=P-B;
  Vector CP=P-C;
  double calc1=AB.x*BP.y - AB.y*BP.x;
  double calc2=BC.x*CP.y - BC.y*CP.x;
  double calc3=CA.x*AP.y - CA.y*AP.x;
  if( (calc1>0 && calc2>0 && calc3>0)||(calc1<0 && calc2<0 && calc3<0) )
    return false;
  return true;
      }

C++: #include<iostream>
#include<complex>
#include<queue>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t p,xy_t q)
{
  return (conj(p)*q).imag();
}
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 S1,S2,S3;
    S1 = cross_product(a - p, b - p);
    S2 = cross_product(b - p, c - p);
    S3 = cross_product(c - p, a - p);
    bool ok = (S1 > 0 && S2 > 0 && S3 > 0) || (S1 < 0 && S2 < 0 && S3 < 0);
    cout << (ok ? "YES":"NO") << endl;
  }
}