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 <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	double x[3], y[3];
	double xp, yp;
	while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf"
		, &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF)
	{
		double cross[3];
		for (int i = 0; i < 3; ++i)
		{
			double ax = xp - x[i%3];
			double ay = yp - y[i%3];
			double bx = x[i%3+1] - x[i%3];
			double by = y[i%3+1] - y[i%3];
			cross[i] = ax * by - bx * ay;
		}
		if (cross[0] > 0 && cross[1] > 0 && cross[2] > 0
		|| cross[0] < 0 && cross[1] < 0 && cross[2] < 0)
			puts("YES");
		else
			puts("NO");
	}

	return 0;
}

C++: #include <stdio.h>
#define line(x1,y1,x2,y2,x3,y3,c) c == '>' ? y3 > (1 / (x1 - x2)) * ((y1 - y2) * x3 + x1 * y2 - x2 * y1):(c == '<' ? y3 < (1 / (x1 - x2)) * ((y1 - y2) * x3 + x1 * y2 - x2 * y1) : 0)

int main(void){
	double x[3], y[3], xp, yp;
	int i;
	for(i = 0;i < 3;i++)
		scanf("%lf%lf",&x[i],&y[i]);
	scanf("%lf%lf",&xp,&yp);
	if(x[0] < x[1]){
		int tmpx = x[0];
		int tmpy = y[0];
		x[0] = x[1];
		y[0] = y[1];
		x[1] = tmpx;
		y[1] = tmpy;
	}
	if(line(x[0],y[0],x[1],y[1],x[2],y[2],'>') && line(x[0],y[0],x[1],y[1],xp,yp,'>')){
		if(x[2] > x[0]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'>') && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[0]){
			if(x[2] > xp && y[2] > yp && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] > x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'<') && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[1]){
			if(x[2] > xp && y[2] > yp && line(x[0],y[0],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] < x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'<') && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
	else if(line(x[0],y[0],x[1],y[1],x[2],y[2],'<') && line(x[0],y[0],x[1],y[1],xp,yp,'<')){
		if(x[2] > x[0]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'<') && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[0]){
			if(x[2] > xp && y[2] < yp && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] > x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'>') && line(x[1],y[1],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] == x[1]){
			if(x[2] > xp && y[2] < yp && line(x[0],y[0],x[2],y[2],xp,yp,'>'))
				printf("YES\n");
			else
				printf("NO\n");
		}else if(x[2] < x[1]){
			if(line(x[0],y[0],x[2],y[2],xp,yp,'>') && line(x[1],y[1],x[2],y[2],xp,yp,'<'))
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
	else
		printf("NO\n");
	return 0;
}

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

using namespace std;

typedef	complex<double> P;

double dot(P a, P b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}

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

	double xp,yp,x1,x2,x3,y1,y2,y3;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		P p1(x1,y1);
		P p2(x2,y2);
		P p3(x3,y3);
		P p(xp,yp);

		double v1 = cross(p1,p2);
		double v2 = cross(p1,p3);
		double v3 = cross(p2,p3);

		if((v1>=0&&v2>=0&&v3>=0)||(v1<0&&v2<0&&v3<0))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;

	}

	return 0;
}

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

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

bool ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>0;
}

int main()
{
	for(string s;getline(cin,s);){
		istringstream iss(s);
		vector<double> x(3),y(3);
		rep(i,3)
			iss>>x[i]>>y[i];
		double xp,yp;
		iss>>xp>>yp;
		
		bool in_triangle=true;
		rep(i,3)
			if(ccw(x[0],y[0],x[1],y[1],xp,yp)!=ccw(x[1],y[1],x[2],y[2],xp,yp))
				in_triangle=false;
		
		cout<<(in_triangle?"YES":"NO")<<endl;
	}
	
	return 0;
}

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

double x1, y1, x2, y2, x3, y3, xp, yp;

int side(double p1_x, double p1_y, double p2_x, double p2_y){
	double n = xp*(p1_y - p2_y) + p1_x*(p2_y - yp) + p2_x*(yp - p1_y);
	if(n > 0) return 1; // left
	else if(n < 0) return -1; //right
	else return 0; //on_line
}

bool judge_in(){
	int pab = side(x1,y1,x2,y2);
	int pbc = side(x2,y2,x3,y3);
	int pca = side(x3,y3,x1,y1);

	if((pab > 0) && (pbc > 0) && (pca > 0)) return true;
	if((pab < 0) && (pbc < 0) && (pca < 0)) return true;
	return false;
}


int main(){
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		bool judge = judge_in();
		if(judge == true) cout << "YES" << endl;
		else if(judge == false) cout << "NO" << endl;
	}
}

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

struct Vector{
	double x;
	double y;
};

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

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	Vector v[4];
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		v[0].x=x1; //a
		v[0].y=y1;
		v[1].x=x2; //b
		v[1].y=y2;
		v[2].x=x3; //c
		v[2].y=y3;
		v[3].x=xp; //p
		v[3].y=yp;
		Vector ab = sub_vector(v[1] , v[0]);
		Vector pb = sub_vector(v[3] , v[1]);
		Vector cb = sub_vector(v[2] , v[1]);
		Vector cp = sub_vector(v[3] , v[2]);
		Vector ca = sub_vector(v[0] , v[2]);
		Vector pa = sub_vector(v[3] , v[0]);
		double c1 = ab.x * pb.y - ab.y * pb.x; //??????
		double c2 = cb.x * cp.y - cb.y * cp.x;
		double c3 = ca.x * pa.y - ca.y * pa.x;
		if((c1<0 && c2<0 && c3 <0)||(c1>=0 && c2>=0 && c3>=0)) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
		
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int main() {
    while(true){
        for(int i=0; i<4; ++i){
            cin >> x[i] >> y[i];}
            if(!cin) break;
            xy_t a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]),p(x[3],y[3]);
            double pab = cross_product(a-p, b-p);
            double pbc = cross_product(b-p, c-p);
            double pca = cross_product(c-p, a-p);
            bool ok = abs(pab+pbc+pca) == abs(pab)+abs(pbc)+abs(pca);
            cout << (ok ? "YES" : "NO") << endl;
            }
    return 0;
}