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>
#include<math.h>
using namespace std;
struct vect{
  double x,y;
};
double leng(vect a,vect b){
  return sqrt((a.x - b.x)*(a.x - b.x)+(a.y - b.y)*(a.y - b.y));
    }
double Sc(vect a,vect b,vect c){
  double S,l1,l2,l3; 
  l1 = leng(a,b);
  l2 = leng(b,c);
  l3 = leng(c,a);
  S = (l1 + l2 + l3) / 2;
  S = sqrt(S*(S-l1)*(S-l2)*(S-l3));
  if(S >= 0){
    return S;}
}

int main(){
  vect a,b,c,p;
  double s1,s2,s3,s;
  while(cin >> a.x >> a.y  >> b.x >> b.y >>c.x >>c.y >> p.x >> p.y){
    s1 = Sc(a,b,p); s2 = Sc(a,p,c); s3 = Sc(p,b,c); 
    s = Sc(a,b,c);
    if( (Sc(p,b,c) + Sc(a,p,c) + Sc(a,b,p)) == Sc(a,b,c)){cout << "YES" << endl;
    }else {cout << "NO" << endl;}
    
  }
}

C++: #include <iostream>
#include <vector>

using namespace std;

bool checker(double a, double b,double x, double y, double px, double py);

double calc_slope(double x1, double y1, double x2, double y2);

int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  double a1, a2, a3, b1, b2, b3;
  vector<double> x1s,y1s,x2s,y2s,x3s,y3s,xps,yps;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    x1s.push_back(x1);
    y1s.push_back(y1);
    x2s.push_back(x2);
    y2s.push_back(y2);
    x3s.push_back(x3);
    y3s.push_back(y3);
    xps.push_back(xp);
    yps.push_back(yp);
  }

  for(int i=0; i<x2s.size(); i++){
    bool flag = true;
    x1 = x1s[i];
    y1 = y1s[i];
    x2 = x2s[i];
    y2 = y2s[i];
    x3 = x3s[i];
    y3 = y3s[i];
    xp = xps[i];
    yp = yps[i];


    a1 = calc_slope(x1,y1,x2,y2);
    b1 = -a1*x1+y1;
    flag &= checker(a1,b1,x3,y3,xp,yp);

    a2 = calc_slope(x2,y2,x3,y3);
    b2 = -a2*x2+y2;
    flag &= checker(a2,b2,x1,y1,xp,yp);

    a3 = calc_slope(x3,y3,x1,y1);
    b3 = -a3*x3+y3;
    flag &= checker(a3,b3,x2,y2,xp,yp);

    if(flag){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

bool checker(double a, double b, double ox, double oy, double px, double py){ 
  if(a == 0){
    if(b <= ox && b <= px){
      return true;
    }
    else if(b > ox && b > px){
      return true;
    }
  }

  if(oy <= a*ox+b && py <= a*px+b){
    return true;
  }
  else if(oy > a*ox+b && py > a*px+b){
    return true;
  }
  else{
    return false;
  }
}

double calc_slope(double x1, double y1, double x2, double y2){
  if(x1 > x2){
    return (y1-y2)/(x1-x2);
  }else if(x1 < x2){
    return (y2-y1)/(x2-x1);
  }else{
    return 0;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <sstream>
#include <cstdio>
using namespace std;

// A Point in a Triangle(0012)
double area(const double x1, const double y1, const double x2, const double y2, const double x3, const double y3)
{
	return abs(x1*y2 - x1*y3 + x2*y3 - x2*y1 + x3*y1 - x3*y2) / 2.0;
}

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double St = area(x1, y1, x2, y2, x3, y3);

		double S1 = area(x1, y1, x2, y2, xp, yp);
		double S2 = area(x2, y2, x3, y3, xp, yp);
		double S3 = area(x3, y3, x1, y1, xp, yp);

		if (S1 != 0 && S2 != 0 && S3 != 0 && S1+S2+S3 == St)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

struct Point{
	double x,y;
	Point(double x=0.0,double y=0.0):x(x),y(y){}
};

typedef Point Vector;

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

int 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)){
		Vector v1(x2-x1,y2-y1),v2(x3-x2,y3-y2),v3(x1-x3,y1-y3);
		Vector u1(xp-x1,yp-y1),u2(xp-x2,yp-y2),u3(xp-x3,yp-y3);
		if (cross(v1,u1)*cross(v2,u2)>0 && cross(v2,u2)*cross(v3,u3)>0){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

float area(float x1,float y1,float x2,float y2,float x3,float y3)
{
   return abs((x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2.0);
}
bool res(float x1,float y1,float x2,float y2,float x3,float y3,float x,float y)
{
   float A = area (x1, y1, x2, y2, x3, y3);
   float A1 = area (x, y, x2, y2, x3, y3);
   float A2 = area (x1, y1, x, y, x3, y3);
   float A3 = area (x1, y1, x2, y2, x, y);
   return (A == A1 + A2 + A3);
}

int main()
{
   float x1,x2,x3,y1,y2,y3,x,y;
   while (scanf ("%f %f %f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3,&x,&y)==8)
   {
      if (res(x1,y1,x2,y2,x3,y3,x,y))
     printf ("YES\n");
   else
     printf ("NO\n");
   }
   return 0;
}