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>
#include <stdio.h>
#include <utility>
using namespace std;
int main(){
	double px,py;
	double tx[3],ty[3];
	bool flag;
	bool v[3];
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&tx[0],&ty[0],&tx[1],&ty[1],&tx[2],&ty[2],&px,&py) == 8){
		for(int i=0;i<3;i++){
			tx[i]=tx[i]-px;
			ty[i]=ty[i]-py;
		}
		for(int i=0;i<3;i++){
			if((tx[i%3]*ty[(i+1)%3])-(ty[i%3]*tx[(i+1)%3])<0){
				v[i]=true;
			}else{
				v[i]=false;
			}
		}
		
		if(v[0]!=v[1]){
			cout<<"NO"<<endl;
		}else if(v[1]!=v[2]){
			cout<<"NO"<<endl;
		}else {
			cout<<"YES"<<endl;
		}
	}
	return 0;
}

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

int main(){
  float x1,y1,x2,y2,x3,y3,xp,yp;
  float a1,b1,a2,b2,A,B;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
    a1=x2-x1;
    a2=y2-y1;
    b1=x3-x1;
    b2=y3-y1;
    xp=xp-x1;
    yp=yp-y1;
    A=(b1*yp-b2*xp)/(a2*b1-a1*b2);
    B=(a2*xp-a1*yp)/(a2*b1-a1*b2);
    if(A+B<1&&A>0&&B>0) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <cstdio>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){

float x[3],y[3],xp,yp,detA,s,t;

while(scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&xp,&yp) != EOF){

detA=(x[2]-x[0])*(y[1]-y[0])-(x[1]-x[0])*(y[2]-y[0]);
s=((y[1]-y[0])*(xp-x[0])-(x[1]-x[0])*(yp-y[0]))/detA;
t=(-(y[2]-y[0])*(xp-x[0])+(x[2]-x[0])*(yp-y[0]))/detA;

if(0 < s && s < 1 && 0 < t && t < 1)
	printf("YES\n");
else
	printf("NO\n");

}
return 0;		
}

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

using namespace std;

double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
  
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

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

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

int is_point_on_line(point a, point b, point c) {
  return cross(b-a, c-a)==0.0 &&
         (dot(b-a, c-a) > -EPS) &&
         (dot(a-b, c-b) > -EPS);
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {

  if(cross(a1-a2,b1-b2)==0){
    return is_point_on_line(a1,a2,b1) || is_point_on_line(a1,a2,b2) 
        || is_point_on_line(b1,b2,a1) || is_point_on_line(b1,b2,a2);
  }
  else {
    return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
           ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
  }
}

int inside(point p, vector<point> ps){
  point a,b;
  a=b=p;

  b.x=DBL_MAX;

  int n=ps.size();
  ps.push_back(ps[0]);

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<n;i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;
  
  for(int i=0;i<n;i++){
    if(is_point_on_line(ps[i],ps[i+1],p))return 1;
  }
  
  int cnt1=0;
  for(int i=0;i<n;i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  int cnt=0;
  for(int i=0;i<n;i++)
    if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;
  
  return (cnt-cnt1/2)%2;
}

int main(void){
 
  point in[4],p;
  vector<point>ps;

  while(cin>>in[1].x>>in[1].y>>in[2].x>>in[2].y>>in[3].x>>in[3].y>>p.x>>p.y){

    ps.clear();

    for(int i=1;i<4;i++)
    ps.push_back(in[i]);

    if(inside(p,ps))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
 
  return 0;
}

C++: #include <iostream>

template <typename T>
struct Vector
{
    T x , y;

    auto operator - (Vector v) -> Vector
    {
        return Vector <T> {x - v.x , y - v.y};
    }
    auto cross (Vector v) -> T
    {
        return x * v.y - y * v.x;
    }
};

auto main () -> int
{
    Vector <double> vecA , vecB , vecC , vecP;
    while (std::cin >> vecA.x >> vecA.y >> vecB.x >> vecB.y >> vecC.x >> vecC.y >> vecP.x >> vecP.y)
    {
        auto vecAB = vecB - vecA;
        auto vecBC = vecC - vecB;
        auto vecCA = vecA - vecC;

        auto vecAP = vecP - vecA;
        auto vecBP = vecP - vecB;
        auto vecCP = vecP - vecC;

        auto c1 = vecAB.cross (vecAP);
        auto c2 = vecBC.cross (vecBP);
        auto c3 = vecCA.cross (vecCP);

        if (c1 < 0 && c2 < 0 && c3 < 0 || c1 > 0 && c2 > 0 && c3 > 0)
        {
            std::cout << "YES" << std::endl;
        }
        else
        {
            std::cout << "NO" << std::endl;
        }
    }
}

C++: #include <iostream>
#include <vector>
#include <iterator>
#include <numeric>
using namespace std;

struct Point2D {
    double x, y;

    Point2D() {}
    Point2D(double ax, double ay) {
        x = ax;
        y = ay;
    }
    Point2D operator -(Point2D &p) {
        return Point2D(x - p.x, y - p.y);
    }
    double cross(Point2D &p) { // only z
        return x * p.y - y * p.x;
    }
};

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

    ostream &operator<<(ostream &os, Point2D &p) {
        os << fixed << p.x << " " << p.y;
        return os;
    }

    template <typename T>
    ostream &operator<<(ostream &os, vector<T> &v) {
        if (v.size()) {
            cout << v.front();
            for (auto vi = v.begin() + 1; vi != v.end(); vi++)
                cout << " " << *vi;
        }

        return os;
    }
}

template <typename T>
inline int sign(T x) { return (x > T(0)) - (x < T(0)); }

int main()
{
    vector<Point2D> triangle(3);
    Point2D p;

    for (; cin >> triangle[0] >> triangle[1] >> triangle[2] >> p;) {
        int acc = 0;
        for (int i = 0; i < 3; i++) {
            Point2D v = triangle[i] - triangle[(i + 1) % 3];
            Point2D pv = triangle[i] - p;

            acc += sign(v.cross(pv));
        }
        cout << ((abs(acc) == 3) ? "YES" : "NO") << endl;
    }

    return 0;
}