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<stdio.h>
#include<iostream>
using namespace std;

double outer_product_z(double X[], double Y[]){
	return X[0]*Y[1]-X[1]*Y[0];
}
double x[4], y[4];
int main(){
	while(1){
		for(int i=0;i<4;i++){
			cin >> x[i] >> y[i];
		}
		double vec_ap[2] = {(x[3]-x[0]),(y[3]-y[0])};
		double vec_bp[2] = {(x[3]-x[1]),(y[3]-y[1])};
		double vec_cp[2] = {(x[3]-x[2]),(y[3]-y[2])};
		double vec_ab[2] = {(x[1]-x[0]),(y[1]-y[0])};
		double vec_bc[2] = {(x[2]-x[1]),(y[2]-y[1])};
		double vec_ca[2] = {(x[0]-x[2]),(y[0]-y[2])};

		if((outer_product_z(vec_ap,vec_ab)>0&&outer_product_z(vec_bp,vec_bc)>0&&outer_product_z(vec_cp,vec_ca)>0) || (outer_product_z(vec_ap,vec_ab)<0&&outer_product_z(vec_bp,vec_bc)<0&&outer_product_z(vec_cp,vec_ca)<0)) cout << "Yes" << endl;
		else cout << "No" << endl;

		if(cin.eof()) 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(){
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;
	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(){
	bool judge = judge_in();
	if(judge == true) cout << "YES" << endl;
	else if(judge == false) cout << "NO" << endl;
}

C++: #include<cmath>
#include<iostream>
using namespace std;
#define PI 3.141592
int winding_number(int x, int y, double p[][2], int n)
{
  int xx = p[n - 1][0] - x, yy = y - p[n - 1][1] - y;
  double r1 = acos(xx / sqrt(xx * xx + yy * yy)); 
  double s = 0;
  for(int i = 0; i < n; i++)
  {
    int xx = p[i][0] - x, yy = p[i][1] - y;
    double r2 = acos(xx / sqrt(xx * xx + yy * yy));
    // y????????????????¬¬3, 4?±????
    if(yy < 0)
      r2 = PI * 2 - r2;
    double ts = r2 - r1;
    // 180???????????§?????????????????¨?????????
    if(abs(ts) > PI)
      ts = ts / abs(ts) * (PI - abs(ts));
    s += ts ;
    r1 = r2;
  }
  return abs(s) < PI ? 0 : 1;
}


double p[3][2];
int main()
{
  while(cin >> p[0][0] >> p[0][1] >> p[1][0] >> p[1][1] >> p[2][0] >> p[2][1])
  {
    double x, y;
    cin >> x >> y;
    cout << winding_number(x, y, p, 3) << endl;;
  }
}

C++: #include<iostream>
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;

long double calc(double x1,double y1,double x2,double y2,double x,double y){
	return (x1-x2)*(y-y1)+(y1-y2)*(x1-x);
}

bool isCross(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
	if( calc(x1,y1,x2,y2,x3,y3) * calc(x1,y1,x2,y2,x4,y4)<0 )
		if( calc(x3,y3,x4,y4,x1,y1) * calc(x3,y3,x4,y4,x2,y2)<0 )
			return true;
	return false;
} 


int main(){
	while(1){
		double x[3],y[3],xp,yp;

		rep(i,3)cin>>x[i]>>y[i];
		if(!(cin>>xp>>yp))break;

		bool cross=false;
		rep(i,3){
			if( isCross(x[i%3],y[i%3],x[(i+1)%3],y[(i+1)%3],x[(i+2)%3],y[(i+2)%3],xp,yp) )
				cross=true;
		}
		if(cross==true){
			cout<<"NO"<<endl;
		}else{
			cout<<"YES"<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<double> xy;

int main() {
	xy a, b, c, p;
	while (cin 
		>> a.real() >> a.imag()
		>> b.real() >> b.imag()
		>> c.real() >> c.imag()
		>> p.real() >> p.imag()) 
	{
		double d, e, f;
		d = (conj(a - p)*(b - p)).imag();
		e = (conj(b - p)*(c - p)).imag();
		f = (conj(c - p)*(a - p)).imag();
		if ((d < 0 && e < 0 && f < 0) || (d > 0 && e > 0 && f > 0))	cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#define INF 100000000
using namespace std;
typedef double d;
bool isintersect(d x1,d x2, d y1 , d y2 , d px, d py , d qx, d qy)
{
  return ((py-y1)*(x1-x2) + (px - x1)*(y1-y2))*((qy-y1)*(x1-x2) + (qx - x1)*(y1-y2)) > 0;
}
int main(){
  double x1,y1,x2,y2,x3,y3,xp,yp;
  while( cin >>  x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp )
    {
      if( isintersect(x1,x2,y1,y2,xp,yp,x3,y3) &&
	  isintersect(x1,x3,y1,y3,xp,yp,x2,y2) &&
	  isintersect(x3,x2,y3,y2,xp,yp,x1,y1))cout << "YES" << endl;
      else cout << "NO" << endl;
    }
  return 0;
}

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

using namespace std;

#define EPS 1e-10

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}
    Point operator - (const Point &p) const {  return Point(x - p.x, y - p.y); }
};

double dot(const Point &a, const Point &b)
{
    return a.x * b.x + a.y * b.y;
}

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

double norm(const Point &p){
    return dot(p, p);
}

#define COUNTER_CLOCKWISE +1
#define CLOCKWISE         -1
#define ONLINE_BACK       +2
#define ONLINE_FRONT      -2
#define ON_SEGMENT        +0
typedef Point Vector;

int ccw(const Point &p0, const Point &p1, const Point &p2)
{
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS)  return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS) return CLOCKWISE;
    if (dot(a, b) < -EPS)   return ONLINE_BACK;
    if (norm(a) < norm(b))  return ONLINE_FRONT;
    return ON_SEGMENT; 
}

istream &operator >> (istream &is, Point &p)
{
    return is >> p.x >> p.y;
}

bool in_triangle(Point *p, Point &xp)
{
    for (int i = 0; i < 3; i++) {
        if (ccw(xp, p[i], p[(i+1)%3]) != COUNTER_CLOCKWISE) {
            return 0;
        }
    }
    return 1;
}

int main()
{
    Point p[3], xp;
    while (cin >> p[0] >> p[1] >> p[2] >> xp) {
        cout << (in_triangle(p, xp) ? "YES" : "NO") << endl;
    }
    return 0;
}

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

struct Pos{
	double x,y;
};

Pos VSub(Pos pos1,Pos pos2){
	pos1.x -= pos2.x;
	pos1.y -= pos2.y;
	return pos1;
}
int main(){
	Pos point[4];	//point[3]:ten
	char *c[200];
	int i,cor = 0;
	while(cin >> point[0].x){
		cin >> point[0].y;
		for(i = 1;i < 4;i++){
			cin >> point[i].x >> point[i].y;
		}
		Pos v[6];
		double at[6];
		for(i = 0;i < 3;i++){
			v[i] = VSub(point[(i+1)%3],point[i]);
			at[i] = atan2(v[i].y,v[i].x);
			v[i+3] = VSub(point[3],point[i]);
			at[i+3] = atan2(v[i+3].y,v[i+3].x);
		}
		if(at[0] > at[3] && at[1] > at[4] && at[2] > at[5])
			c[cor] = "YES";
		else if(at[0] < at[3] && at[1] < at[4] && at[2] < at[5])
			c[cor] = "YES";
		else
			c[cor] = "NO";
		cor++;
	}
	for(i = 0;i < cor;i++)
		cout << c[i] << endl;
}

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

int main(){
	double x[3],y[3],xp,yp;
	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
		//??????
		double gaiseki[3];
		for(int i=0;i<3;i++){
			double vx,vy,vxp,vyp;
			vx = x[(i+1)%3]-x[i];
			vy = y[(i+1)%3]-y[i];
			vxp = xp-x[i];
			vyp = yp-y[i];
			gaiseki[i] = vx*vyp-vy*vxp;
		}
		if(gaiseki[0]>0&&gaiseki[1]>0&&gaiseki[2]>0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}