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;

class Triangle {

public:
	double Cross_Product_AB_AP, Cross_Product_BC_BP, Cross_Product_CA_CP;
	double Vec_ABx, Vec_BCx, Vec_CAx, Vec_APx, Vec_BPx, Vec_CPx;
	double Vec_ABy, Vec_BCy, Vec_CAy, Vec_APy, Vec_BPy, Vec_CPy;


	Triangle(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp);

	bool IsInTriangle();
};


Triangle::Triangle(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp){



	//??????????±???????
	//A(x1,y1),B(x2,y2),C(x3,y3),P(xp,yp)??¨????????????
	
	Vec_ABx = x2 - x1;
	Vec_BCx = x3 - x2;
	Vec_CAx = x1 - x3;
	Vec_APx = xp - x1;
	Vec_BPx = xp - x2;
	Vec_CPx = xp - x3;

	Vec_ABy = y2 - y1;
	Vec_BCy = y3 - y2;
	Vec_CAy = y1 - y3;
	Vec_APy = yp - y1;
	Vec_BPy = yp - y2;
	Vec_CPy = yp - y3;



	//AB??AP
	Cross_Product_AB_AP = Vec_ABx*Vec_APy - Vec_ABy*Vec_APx;
	//BC??BP
	Cross_Product_BC_BP = Vec_BCx*Vec_BPy - Vec_BCy*Vec_BPx;
	//CA??CP
	Cross_Product_CA_CP = Vec_CAx*Vec_CPy - Vec_CAy*Vec_CPx;

};


//????§???¢????????¨????????????????????????????????????
bool Triangle::IsInTriangle(){

	if ((Cross_Product_AB_AP >= 0 && Cross_Product_BC_BP >= 0 && Cross_Product_CA_CP >= 0) ||
		(Cross_Product_AB_AP <= 0 && Cross_Product_BC_BP <= 0 && Cross_Product_CA_CP <= 0)){

		return true;
	
	}
	else { return false;}

};


int main(){

	double x1, y1, x2, y2, x3, y3, xp, yp;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
	
		//????§???¢???????????§????????????
		Triangle Triangle(x1, y1, x2, y2, x3, y3, xp, yp);
		if (Triangle.IsInTriangle() == true){
			cout << "YES"<<endl;
		}
		else if (Triangle.IsInTriangle() == false) {
			cout << "NO" << endl;
		}
	}


	return 0;
}

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

typedef complex<double> Point;

double cross(Point a, Point b){
    return (conj(a)*b).imag();
}

int main(){
    Point V[3], P;
    while(true){
        double x, y;
        for(int i=0; i<3; i++){
            if(!(cin >> x >> y))
                return 0;
            V[i] = {x, y};
        }
        cin >> x >> y;
        P = {x, y};
        
        int sum = 0;
        for(int i=0; i<3; i++){
            sum += cross(V[(i+1)%3]-V[i], (P-V[i])) > 0;
        }
        cout << (sum==0 || sum==3? "YES": "NO") << endl;
    }
    return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    double x1,y1,x2,y2,x3,y3,a,b;
    while(cin>>x1){
        cin>>y1>>x2>>y2>>x3>>y3>>a>>b;
        double c=abs((x1-a)*(y2-b)-(x2-a)*(y1-b))/2;
        double d=abs((x2-a)*(y3-b)-(x3-a)*(y2-b))/2;
        double e=abs((x1-a)*(y3-b)-(x3-a)*(y1-b))/2;
        double f=abs((x1-x3)*(y2-y3)-(x2-x3)*(y1-y3))/2;
        if(f==c+d+e){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
        
        
    }
    
    
    
    return 0;
}