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 <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;
#define EPS (1e-6)
double zero(double d){
  return d < EPS ? 0.0 : d;
}

typedef pair<double,double> P;

bool isCross(P p1, P p2, P p3, P p4){
  double c = ((p1.first - p2.first) * (p3.second - p1.second) + (p1.second - p2.second) * (p1.first - p3.first)) * 
    ((p1.first - p2.first) * (p4.second - p1.second) + (p1.second - p2.second) * (p1.first - p4.first));
  if(c<=0.0)
    return true;
  return false;
}

int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(3);

  int INF = 1000000;

  double x1,y1,x2,y2,x3,y3,xp,yp;
  while( cin >>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
    P p1(x1,y1),p2(x2,y2),p3(x3,y3),px(xp,yp);
    if( isCross(p1,p2,p3,px) || isCross(p1,p3,p2,px) || isCross(p2,p3,p1,px) )
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  


  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    double x[4],y[4],xe[2]={},ye[2]={};
    while(cin>>x[0]>>y[0]){
        for(int i=1;i<4;i++)cin>>x[i]>>y[i];
        for(int i=0;i<3;i++){
            xe[0]=max(x[i],xe[0]);
            xe[1]=min(x[i],xe[1]);
            ye[0]=max(y[i],ye[0]);
            ye[1]=min(y[i],ye[1]);
        }
        if(xe[0]>x[3]&&xe[1]<x[3]&&ye[0]>y[3]&&ye[1]<y[3])cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std;

typedef struct{
    double x;
    double y;
}vec;
vec makeVec(vec p,vec q){
    vec r;
    r.x=q.x-p.x;
    r.y=q.y-p.y;
    return r;
}

double crossZe(vec p,vec q){
    if(p.x*q.y-p.y*q.x==0.0) return 0.0;
    return (p.x*q.y-p.y*q.x)/fabs(p.x*q.y-p.y*q.x);
}

bool Tri(vec p[3],vec q[3]){
    double c,d;
    c = crossZe(p[0],q[0]);
    if(c==0) return false;
    for(int i=1;i<3;i++){
        d=crossZe(p[i],q[i]);
        if(c!=d||d==0.0) return false;
    }
    return true;
}
int main(int argc, const char * argv[]) {
    vec p[3],q,r[3],rq[3];
    while(cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y){
        cin >> q.x >> q.y;
        r[0]=makeVec(p[0],p[1]);
        r[1]=makeVec(p[1],p[2]);
        r[2]=makeVec(p[2],p[0]);
        rq[0]=makeVec(q,p[1]);
        rq[1]=makeVec(q,p[2]);
        rq[2]=makeVec(q,p[0]);
        if(Tri(r,rq)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

struct TPoint
{
    double x;
    double y;
    TPoint(){}
    TPoint(int X, int Y)
     : x(X), y(Y){}
};
struct TTriangle
{
    TPoint p1;
    TPoint p2;
    TPoint p3;
};
typedef TPoint TVector;
TVector Vector(const TPoint& A, const TPoint& B)
{
    return TVector(B.x - A.x, B.y - A.y);
    // return TVector(A.x - B.x, A.y - B.y);
}
double Cross(const TVector& A, const TVector& B)
{
    return A.x * B.y - B.x * A.y;
}

bool IsContain(const TTriangle& Tri, const TPoint& P)
{
    bool s1 = Cross(Vector(Tri.p1, Tri.p2), Vector(Tri.p1, P)) < 0;
    bool s2 = Cross(Vector(Tri.p2, Tri.p3), Vector(Tri.p2, P)) < 0;
    bool s3 = Cross(Vector(Tri.p3, Tri.p1), Vector(Tri.p3, P)) < 0;
    // std::cout << s1 << s2 << s3 << std::endl;
    return s1 == s2 && s2 == s3;
}
int main()
{
    while(true){
        TTriangle Tri;
        TPoint P;
        std::cin >> Tri.p1.x >> Tri.p1.y >> Tri.p2.x >> Tri.p2.y >> Tri.p3.x >> Tri.p3.y >> P.x >> P.y;
        if(std::cin.eof()) break;
        std::cout << (IsContain(Tri, P) ? "YES" : "NO") << std::endl;
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <math.h>
#include <utility>
#include <cstdlib>
using namespace std;

int main(){
	int n;
	cin >> n;
	while(1){
		bool ans=true;
		double x[3],y[3],xp,yp;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp;
		if(!x[0]&&!x[1]&&!x[2]&&!y[0]&&!y[1]&&!y[2]&&!xp&&!yp) break;
		//???????????¨????????????
		double gaiseki[3];	//gaiseki[i]???????????????P0P1??¨????????????P0Q????????????z??§?¨?
		for(int i=0;i<3;i++){
			int k = (i+1)%3;
			double vx,vy,vpx,vpy;
			vx = x[k]-x[i];
			vy = y[k]-y[i];
			vpx = xp-x[i];
			vpy = yp-y[i];
			gaiseki[i] = vx*vpy-vy*vpx;
			if(gaiseki[i]<=0) ans = false;
		}
		if(ans){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

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

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
static const double EPS = 1e-6;

double x[3],y[3];
double xp,yp;

double dist(P a,P b){
	return (sqrt((real(a)-real(b))*(real(a)-real(b))+(imag(a)-imag(b))*(imag(a)-imag(b))));
}

double tri_pro(P a,P b,P c){
	double aa,bb,cc;
	aa = dist(b,c);
	bb = dist(c,a);
	cc = dist(a,b);
	double s = (aa+bb+cc)/2.0;
	return sqrt(s*(s-aa)*(s-bb)*(s-cc));
}


int main(){
	while(cin>>x[0]>>y[0]){
		rep(i,2) cin>>x[i+1]>>y[i+1];
		cin>>xp>>yp;
		P a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]);
		P p(xp,yp);
		double sa,sb,sc;
		sa = tri_pro(b,c,p);
		sb = tri_pro(c,a,p);
		sc = tri_pro(a,b,p);
		double s = tri_pro(a,b,c);
		//cout<<"s="<<s<<"\nsa sb sc "<<sa<<" "<<sb<<" "<<sc<<endl;
		//printf("s=%.8f\nsa+sb+sc %.8f\n",s,sa+sb+sc);
		if((sa+sb+sc)-s<EPS) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

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

using namespace std;

typedef complex<double> P;

#define  EPS (1e-11)
#define  EQ(a, b)  (abs((a) - (b)) < EPS)
#define  EQV(a, b)  (EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))

double cross(P a, P b) 
{
    return (a.real() * b.imag() - a.imag() * b.real());
}

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

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

        if ((cross(b - a, x - a) > EPS &&
             cross(c - b, x - b) > EPS &&
             cross(a - c, x - c) > EPS) ||
            (cross(b - a, x - a) < -EPS &&
             cross(c - b, x - b) < -EPS &&
             cross(a - c, x - c) < -EPS))
            cout << "YES\n";
        else
            cout << "NO\n";
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
double x[4],y[4],px,py,ax,ay,bx,by;
int main()
{
	while(true)
	{
		for(int i = 1;i<=3;i++){cin >> x[i];cin >> y[i];}
		if(cin.eof())break;
		cin >> px;
		cin >> py;
		double m,n,s;
		ax = x[2]-x[1];
		ay = y[2]-y[1];
		bx = x[3]-x[1];
		by = y[3]-y[1];
		double det = ax*by-ay*bx;
		m = (by*px-bx*py)/det;
		n = (-ay*px+ax*py)/det;
		if(m>0 && n > 0&& (m+n) < 1) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}