Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <iostream>

#define SIZE 3

using namespace std;

float innerProduct(float xp, float yp, float x1, float y1, float x2, float y2) {
	return (x1-xp) * (x1-x2) + (y1-yp) * (y1-y2);
}

int main() {
	float x[SIZE], y[SIZE], xp, yp, a, b, c;

	while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp) {
		a = innerProduct(xp, yp, x[0], y[0], x[1], y[1]);
		b = innerProduct(xp, yp, x[1], y[1], x[2], y[2]);
		c = innerProduct(xp, yp, x[2], y[2], x[0], y[0]);

		if ((a >= 0 && b >= 0 && c >= 0) || (a <= 0 && b <= 0 && c <= 0)) {
			cout << "YES";
		}
		else {
			cout << "NO";
		}
		cout << endl;
	}
	return 0;
}

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

bool solve(double a1, double b1, double a2, double b2, double x, double y)
{
	if((a2-a1)*(a2-a1)+(b2-b1)*(b2-b1) > max((x-a1)*(x-a1)+(y-b1)*(y-b1),(a2-x)*(a2-x)+(b2-y)*(b2-y)))
		return true;
	return false;
}

int main()
{
	double x1,y1,x2,y2,x3,y3,xp,yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		if(solve(x1,y1,x2,y2,xp,yp) && solve(x2,y2,x3,y3,xp,yp) && solve(x3,y3,x1,y1,xp,yp))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
int CCross(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
	double S,T,D;	//	一時変数を宣言

	//	分母を先に計算。計算量を減らすため、分子は後で行う。
	D = (x3-x1) * (y4-y1) - (y3-y1) * (x4-x1);
	
	//	D の符号に応じて分岐
	if(D < 0){
	  S = (y4-y1)*(x2-x1) - (x4-x1)*(y2-y1);
	  T = (x3-x1)*(y2-y1) - (y3-y1)*(x2-x1);
	  
	  return S <= 0 && T <= 0 && (S+T)/D >= 1 ;
	}
	else if(D > 0){
	  S = (y4-y1)*(x2-x1) - (x4-x1)*(y2-y1);
	  T = (x3-x1)*(y2-y1) - (y3-y1)*(x2-x1);
	    
	    return S >= 0 && T >= 0 && (S+T)/D >= 1 ;
	}
	
	//	D = 0 の時には、点が線分の上かどうかを判定する。
	return (x3-x1)*(x4-x1)+(y3-y1)*(y4-y1) <= 0
	  || (x3-x2)*(x4-x2)+(y3-y2)*(y4-y2) <= 0
	  || (x1-x3)*(x2-x3)+(y1-y3)*(y2-y3) <= 0;
}
double GetLen(double x1,double y1,double x2,double y2){
  double X1=min(x2,x1),X2=max(x2,x1);
  double Y1=min(y2,y1),Y2=max(y2,y1);
  return sqrt((Y2-Y1)*(Y2-Y1)+(X2-X1)*(X2-X1));
}
main(){
  double x1,y1,x2,y2,x3,y3,xp,yp; 
  while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
    double R;
    double a,b,c;
    a=GetLen(x1,y1,x2,y2);
    b=GetLen(x2,y2,x3,y3);
    c=GetLen(x3,y3,x1,y1);
    if(CCross(x1,y1,xp,yp,x2,y2,x3,y3) ||
       CCross(x2,y2,xp,yp,x3,y3,x1,y1) ||
       CCross(x3,y3,xp,yp,x1,y1,x2,y2) ){
       printf("NO\n");
    }
    else printf("YES\n");
  }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
double heron(double a,double b,double c){
  double s = (a+b+c)/2;
  return sqrt(s*(s - a)*(s - b)*(s - c));
}

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,B,C;
    A = sqrt(pow(x[0] - x[1],2)+pow(y[0] - y[1],2));
    B = sqrt(pow(x[0] - x[2],2)+pow(y[0] - y[2],2));
    C = sqrt(pow(x[2] - x[1],2)+pow(y[2] - y[1],2));

    double S1 = heron(A,B,C);

    double XA,XB,XC;
    XA = sqrt(pow(x[0] - x[3],2)+pow(y[0] - y[3],2));
    XB = sqrt(pow(x[1] - x[3],2)+pow(y[1] - y[3],2));
    XC = sqrt(pow(x[2] - x[3],2)+pow(y[2] - y[3],2));

    double S2 = heron(XA,XB,A) + heron(XA,XC,B) + heron(XB,XC,C);
    if((float)S1 == (float)S2)cout <<"YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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;
}