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;
// 3D vector
class Vector3
{
public:
    Vector3(float fx, float fy, float fz)
        :x(fx), y(fy), z(fz)
    {
    }

    // Subtract
    Vector3 operator - (const Vector3& v) const
    {
        return Vector3(x - v.x, y - v.y, z - v.z) ;
    }

    // Dot product
    float Dot(const Vector3& v) const
    {
        return x * v.x + y * v.y + z * v.z ;
    }

    // Cross product
    Vector3 Cross(const Vector3& v) const
    {
        return Vector3(
            y * v.z - z * v.y,
            z * v.x - x * v.z,
            x * v.y - y * v.x ) ;
    }

public:
    float x, y, z ;
};

// Determine whether point P in triangle ABC
bool PointinTriangle(Vector3 A, Vector3 B, Vector3 C, Vector3 P)
{
    Vector3 v0 = C - A ;
    Vector3 v1 = B - A ;
    Vector3 v2 = P - A ;

    float dot00 = v0.Dot(v0) ;
    float dot01 = v0.Dot(v1) ;
    float dot02 = v0.Dot(v2) ;
    float dot11 = v1.Dot(v1) ;
    float dot12 = v1.Dot(v2) ;

    float inverDeno = 1 / (dot00 * dot11 - dot01 * dot01) ;

    float u = (dot11 * dot02 - dot01 * dot12) * inverDeno ;
    if (u < 0 || u > 1) // if u out of range, return directly
    {
        return false ;
    }

    float v = (dot00 * dot12 - dot01 * dot02) * inverDeno ;
    if (v < 0 || v > 1) // if v out of range, return directly
    {
        return false ;
    }

    return u + v <= 1 ;
}
int main()
{
    float x1,y1,x2,y2,x3,y3,xp,yp;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
    {
        Vector3 A(x1,y1,1);
        Vector3 B(x2,y2,1);
        Vector3 C(x3,y3,1);
        Vector3 P(xp,yp,1);
        if(PointinTriangle(A,B,C,P))
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }


    return 0;
}

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

typedef complex<double> cd;

#define X real()
#define Y imag()

double dot(cd a,cd b){
    return (a*conj(b)).X;
}

double cross(cd a,cd b){
    return -((a*conj(b)).Y);
}

int main(){
    double x,y;

    while(cin>>x>>y){
        vector<cd> v,vec;
        v.push_back(cd(x,y));
        for(int i=1;i<3;i++){
            cin>>x>>y;
            v.push_back(cd(x,y));
        }

        v.push_back(v[0]);

        for(int i=0;i<3;i++){
            vec.push_back(v[i+1]-v[i]);
        }

        cin>>x>>y;

        int all_p=1,all_n=1;

        for(int i=0;i<3;i++){
            double crs=cross(vec[i],cd(x,y)-v[i]);
            all_p &= crs>0;
            all_n &= crs<0;
        }

        if(all_p || all_n){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

bool cross(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
    double a,b,c,d;
    
    a=(x3-x4)*(y1-y3)+(y3-y4)*(x3-x1);
    b=(x3-x4)*(y2-y3)+(y3-y4)*(x3-x2);
    c=(x1-x2)*(y3-y1)+(y1-y2)*(x1-x3);
    d=(x1-x2)*(y4-y1)+(y1-y2)*(x1-x4);
    
    if((c<0)^(d<0))
        return true;
    else
        return false;
}

int main(){
    double x[3],y[3],x_p,y_p;
    
    while(EOF!=scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x_p,&y_p)){

        bool f = true;
        
        for(int i=0;i<3;i++){
    
            if(cross(x[i], y[i], x[(i+1)%3], y[(i+1)%3],x[(i+2)%3], y[(i+2)%3], x_p, y_p)){
                f=false;
            }
            
        }
        
        if(f){
            puts("YES");
        }else{
            puts("NO");
        }
    }
    
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
	float x[3], y[3], xp, yp;
	float sM, s1, s2, s3;
	
	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){
		
		printf("%f %f %f %f %f %f %f %f\n", x[0], x[1], x[2], y[0], y[1], y[2], xp, yp);
		
		sM = ((x[1] - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (y[1] - y[0])) / 2;
		printf("sM = %f\n", sM);
		if (sM < 0){
			sM *= -1;
		}
		
		printf("sM = %f\n", sM);
		
		s1 = ((xp - x[2]) * (y[1] - y[2]) - (x[1] - x[2]) * (yp - y[2])) / 2;
		if (s1 < 0){
			s1 *= -1;
		}
		
		printf("s1 = %f\n", s1);
		
		s2 = ((xp - x[2]) * (y[0] - y[2]) - (x[0] - x[2]) * (yp - y[2])) / 2;
		if (s2 < 0){
			s2 *= -1;
		}
		
		printf("s2 = %f\n", s2);
		
		s3 = ((xp - x[0]) * (y[1] - y[0]) - (x[1] - x[0]) * (yp - y[0])) / 2;
		if (s3 < 0){
			s3 *= -1;
		}
		
		printf("s3 = %f\n", s3);
		
		if (sM >= s1 + s2 + s3){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

C++: #include <iostream>

using namespace std;

typedef struct st_point {
	double x;
	double y;
} Point;

bool isPositiveFuncVal(double &a, double &b, double &c, Point &point);

int main(void)
{
	Point vertex[3] = {{0}, {0}, {0}};
	Point pointP = {0};
	
	while(cin >> vertex[0].x >> vertex[0].y >> vertex[1].x >> vertex[1].y >> vertex[2].x >> vertex[2].y >> pointP.x >> pointP.y){
		int i = 0;
		for(i = 0; i < 3; i++){
			double a = (vertex[i].y - vertex[(i+1)%3].y) / (vertex[i].x - vertex[(i+1)%3].x);
			double b = -1.0;
			double c = vertex[i].y - a * vertex[i].x;
			
			if( isPositiveFuncVal(a, b, c, vertex[(i+2)%3]) != isPositiveFuncVal(a, b, c, pointP) ){
				break;
			}
		}
		
		if(i == 3){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

bool isPositiveFuncVal(double &a, double &b, double &c, Point &point)
{
	return a * point.x + b * point.y + c > 0 ? true : false;
}