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 <cmath>
using namespace std;

int main(void){
	double x1, y1, x2, y2, x3, y3, px, py;
	double a, b, c, ap, bp, cp;
	double tmp;
	double s2, sa2, sb2, sc2;
	double s, sa, sb, sc;

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py){
		a = sqrt(fabs((x2-x3) * (x2-x3) + (y2-y3) * (y2-y3)));
		b = sqrt(fabs((x1-x3) * (x1-x3) + (y1-y3) * (y1-y3)));
		c = sqrt(fabs((x1-x2) * (x1-x2) + (y1-y2) * (y1-y2)));
		ap = sqrt(fabs((x1-px) * (x1-px) + (y1-py) * (y1-py)));
		bp = sqrt(fabs((x2-px) * (x2-px) + (y2-py) * (y2-py)));
		cp = sqrt(fabs((x3-px) * (x3-px) + (y3-py) * (y3-py)));
		
		tmp = (a+b+c) / 2;
		s2 = tmp * (tmp-a) * (tmp-b) * (tmp-c);
		s = sqrt(s2);
		tmp = (a+bp+cp) / 2;
		sa2 = tmp * (tmp-a) * (tmp-bp) * (tmp-cp);
		sa = sqrt(sa2);
		tmp = (b+ap+cp) / 2;
		sb2 = tmp * (tmp-b) * (tmp-ap) * (tmp-cp);
		sb = sqrt(sb2);
		tmp = (c+ap+bp) / 2;
		sc2 = tmp * (tmp-c) * (tmp-ap) * (tmp-bp);
		sc = sqrt(sc2);
		if(fabs(sa+sb+sc-s) < 1e-9) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: //0012 A Point in a Triangle
//½ÊóÉA(x1,y1),(x2,y2),(x3,y3)ð¸_Æµ½Op`ª é
//»ÌOp`É_pªàÉÜÜêÄ¢éÈçÎYESA»¤ÅÈ¢ÈçNOÆoÍ¹æ
//È¨AOp`ÌÓãâ¸_ÍÜÜÈ¢àÌÆ·é

//üÍÍA¡ÌsÅ^¦çêAEOFÉÄI¹·é
//»ê¼êÌsÉÄAx1 y1 x2 y2 x3 y3 xp ypª¼pXy[XæØèÅ^¦çêé
//±êçÍ-100ÈãA100ÈºÌÀÅ é

#include<iostream>
#include<cmath>
using namespace std;

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

//http://www5d.biglobe.ne.jp/~tomoya03/shtml/algorithm/Hougan.htm
//¼üÆüªÌ½è»èÅßé

//from1©çto1ÜÅÌ¼üÆAfrom2©çto2ÜÅÌüªªð·µÄ¢é©
//ßèlª0:¼üÆüªÍdÈÁÄ¢é@>0Fð·µÄ¢é@<0Fð·µÄÈ¢
double Intersect(const Point &from1, const Point &to1, const Point &from2, const Point &to2)
{
	return (
		((from1.x-to1.x)*(from2.y-from1.y) + (from1.y-to1.y)*(from1.x-from2.x)) *
		((from1.x-to1.x)*(to2.y-from1.y) + (from1.y-to1.y)*(from1.x-to2.x))
		);
}
bool IsInvolve(const Point &a, const Point &b, const Point &c, const Point &p)
{
	if(Intersect(a,b,p,c) <= 0)
		return false;
	if(Intersect(b,c,p,a) <= 0)
		return false;
	if(Intersect(c,a,p,b) <= 0)
		return false;
	return true;
}

int main(void)
{
	Point a, b, c, p;
	while(cin >> a.x >> a.y >> b.x >> b.y
		>> c.x >> c.y >> p.x >> p.y)
	{
		if(IsInvolve(a, b, c, p))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

double crp(double x1, double y1, double x2, double y2) {
	return x1 * y2 - y1 * x2;
}

double vabs(double x, double y) {
	return sqrt(x * x + y * y);
}

int main() {
	for(double x1, y1, x2, y2, x3, y3, xp, yp; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;) {
		x1 -= xp;
		x2 -= xp;
		x3 -= xp;
		y1 -= yp;
		y2 -= yp;
		y3 -= yp;

		double v1 = vabs(x1, y1);
		double v2 = vabs(x2, y2);
		double v3 = vabs(x3, y3);

		double rad_a = crp(x1, y1, x2, y2) / (v1 * v2);
		double rad_b = crp(x2, y2, x3, y3) / (v2 * v3);
		double rad_c = crp(x3, y3, x1, y1) / (v3 * v1);

		if(rad_a > 0.0 && rad_b > 0.0 && rad_c > 0.0) puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main( void )
{
  double x1,y1,x2,y2,x3,y3,xp,yp,s1,s2,s3;
  while( 1 ){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
    if( cin.eof() ) break;
    s1 = (x2-x1)*(yp-y1) - (xp-x1)*(y2-y1);
    s2 = (x3-x2)*(yp-y2) - (xp-x2)*(y3-y2);
    s3 = (x1-x3)*(yp-y3) - (xp-x3)*(y1-y3);
    if     ( s1 < 0 && s2 < 0 && s3 < 0 ) cout << "YES" << endl;
    else if( s1 > 0 && s2 > 0 && s3 > 0 ) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int islineCross(double x1, double y1, double x2, double y2, double c1, double c2, double d1, double d2) {
  if (((c2-y1)*(x1-x2)-(c1-x1)*(y1-y2))*((d2-y1)*(x1-x2)-(d1-x1)*(y1-y2)) > 0)
    return -1;
  else
    return 0;
}

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

  while((cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)) {
    int CrossCount = 0;
    if (islineCross(x1,y1,x2,y2,xp,yp,xp+1,yp) == 0)
      CrossCount++; 
    if (islineCross(x2,y2,x3,y3,xp,yp,xp+1,yp) == 0)
      CrossCount++; 
    if (islineCross(x3,y3,x1,y1,xp,yp,xp+1,yp) == 0)
      CrossCount++; 
    
    if (CrossCount%2 == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  } 

  return 0;
}

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) > 0) || ((cross_product(AP, AC) < 0 && cross_product(CP, CB) < 0 && cross_product(BP, BA) < 0)))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;    
  }
}