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 <complex>
#include <iostream>

using xy_t = std::complex<double>;

// Calculate the signed area of a rectungle
double cross_product(xy_t a, xy_t b);
// is point p inside of abc
bool isInsideTriangle(xy_t a, xy_t b, xy_t c, xy_t p);

int main()
{
  double x[4], y[4]; // 4 points in plane
  while (true)
  {
    for (size_t i {}; i < 4; ++i)
      std::cin >> x[i] >> y[i];
    if (!std::cin)
      break;
    xy_t a {x[0], y[0]}, b {x[1], y[1]}, c {x[2], y[2]}, p {x[3], y[3]};
    std::cout << (isInsideTriangle(a, b, c, p) ? "YES" : "NO") << std::endl;
  }
}

double cross_product(xy_t a, xy_t b)
{
  return (std::conj(a) * b).imag();
}

bool isInsideTriangle(xy_t a, xy_t b, xy_t c, xy_t p)
{
  double area[3];
  area[0] = cross_product(a - p, b - p);
  area[1] = cross_product(b - p, c - p);
  area[2] = cross_product(c - p, a - p);
  if ((area[0] > 0 && area[1] > 0 && area[2] > 0)
      || (area[0] < 0 && area[1] < 0 && area[2] < 0))
    return true;
  else 
    return false;
}

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

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y - b.x * a.y;
}

int main()
{
  Vector A, B, C, P;
  while(cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> P.x >> P.y){
    Vector AC = sub_vector(A, C);
    Vector CB = sub_vector(C, B);
    Vector BA = sub_vector(B, A);
    Vector AP = sub_vector(A, P);
    Vector CP = sub_vector(C, P);
    Vector BP = sub_vector(B, P);
    if((cross_product(AP, AC) > 0 && cross_product(CP, CB) > 0 && cross_product(BP, BA)) || (cross_product(AP, AC) < 0 && cross_product(CP, CB) < 0 && cross_product(BP, BA) < 0))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;    
  }
}

C++: #include<bits\stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a),end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

double dist(double x1, double y1, double x2, double y2){
    return sqrt( ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)) );
}

double triangleArea(double x, double y, double z){
    return (y * z * sin( acos( (y * y +  z * z - x * x) / (2 * y * z) ) )) / 2;
}

double inputXY(double x1, double y1, double x2, double y2, double x3, double y3){
    double x, y ,z;
    x = dist(x1, y1, x2, y2);
    y = dist(x2, y2, x3, y3);
    z = dist(x3, y3, x1, y1);
    return triangleArea(x, y, z);
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double allArea, area12, area23, area31;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
    allArea = inputXY(x1, y1, x2, y2, x3, y3);
    area12 = inputXY(xp, yp, x2, y2, x1, y1);
    area23 = inputXY(x2, y2, x3, y3, xp, yp);
    area31 = inputXY(x3, y3, x1, y1, xp, yp);

    if(abs(allArea - (area12 + area23 + area31)) < 0.00001) cout << "YES" << endl;
    else cout << "NO" << endl;

}

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

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		double sall = (x1-x2)*(y1+y2) + (x2-x3)*(y2+y3) + (x3-x1)*(y3+y1);
		double s1 = (x1-x2)*(y1+y2) + (x2-xp)*(y2+yp) + (xp-x1)*(yp+y1);
		double s2 = (x1-xp)*(y1+yp) + (xp-x3)*(yp+y3) + (x3-x1)*(y3+y1);
		double s3 = (xp-x2)*(yp+y2) + (x2-x3)*(y2+y3) + (x3-xp)*(y3+yp);
		if(fabs(sall) == fabs(s1)+fabs(s2)+fabs(s3)){
			cout<<"YES"<<endl;
		} else {
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

typedef complex<double> P;
#define X real()
#define Y imag()

#define PI 3.14159265358979

double exterior_product(P p1, P p2, P p3){
        double vx2 = p2.X - p1.X;
        double vy2 = p2.Y - p1.Y;
        double vx3 = p3.X - p1.X;
        double vy3 = p3.Y - p1.Y;
        return vx2*vy3 - vx3*vy2;
}

int main(){
    double x1, x2, x3;
    double y1, y2, y3;
    double xp, yp;

    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        P a(x1, y1);
        P b(x2, y2);
        P c(x3, y3);
        P p(xp, yp);

        double ex_1 = exterior_product(a, b, p);
        double ex_2 = exterior_product(c, a, p);
        double ex_3 = exterior_product(b, c, p);

        if(ex_1 > 0 && ex_2 > 0 && ex_3 > 0){
            cout << "YES" << endl;
        }
        else if(ex_1 < 0 && ex_2 < 0 && ex_3 < 0){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

float KXmax(float x[3]){
	float max=x[0];
	if(max<x[1]){
		max=x[1];
	}
	if(max<x[2]){
		max=x[2];
	}
	return max;
}

float KXmin(float x[3]){
	float min=x[0];
	if(min>x[1]){
		min=x[1];
	}
	if(min>x[2]){
		min=x[2];
	}
	return min;
}

float KYmax(float y[3]){
	float max=y[0];
        if(max<y[1]){
		max=y[1];
	}
	if(max<y[2]){
		max=y[2];
	}
	return max;
}

float KYmin(float y[3]){
	float min=y[0];
	if(min>y[1]){
		min=y[1];
	}
	if(min>y[2]){
		min=y[2];
	}
	return min;	
}

int main()
{
	float x[3],y[3],p1,p2,Xmax,Xmin,Ymax,Ymin;
	
	for(int i=1;i<=100;i++){
		cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>p1>>p2;
		Xmax=KXmax(x);		
		Xmin=KXmin(x);
		Ymax=KYmax(y);
		Ymin=KYmin(y);
		
		if((Xmin<p1&&Xmax>p1) && (Ymin<p2&&Ymax>p2)){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
		
	}
		
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)

bool judge(double x[3], double y[3]) {
	double rad1 = atan2(y[0], x[0]);
	double rad2 = atan2(y[1], x[1]);
	double rad3 = atan2(y[2], x[2]);
	if(rad3 < rad1 && rad2 < rad3 || rad1 < rad3 && rad3 < rad2) return true;
	else return false;
}

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
		double x[3], y[3];
		x[0] = x2 - x1;
		y[0] = y2 - y1; 
		x[1] = x3 - x1;
		y[1] = y3 - y1;
		x[2] = xp - x1;
		y[2] = yp - y1;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			break;
		}
		x[0] = x1 - x2;
		y[0] = y1 - y2;
		x[1] = x3 - x2;
		y[1] = y3 - y2;
		x[2] = xp - x2;
		y[2] = yp - y2;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			break;
		}
		cout << "YES" << endl;
	}
	return 0;
}