Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

C++: #include<iostream>
using namespace std;
struct vect{
  double x,y;
};
double Sc(vect a,vect b,vect c){
  double S;
  b.x = b.x - a.x;
  b.y = b.y - a.y;
  c.x = c.x - a.x;
  c.y = c.y - a.y;
  S = b.x * c.y - b.y * c.x;
  if(S >= 0){
    return S/2;} else if(S < 0){
    return -S/2;
  }
}
int main(){
  vect a,b,c,p;
  int n;
  cin >> n;
  
  while(cin >> a.x >> a.y  >> b.x >> b.y >>c.x >>c.y >> p.x >> p.y){
    if(Sc(a,b,p) +Sc(a,p,c) +Sc(p,b,c) == Sc (a,b,c)){
      cout << "YES" << endl;
    }else {cout << "NO" << endl;}
    
  }
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<stdio.h>
using namespace std;

int main()
{
 double x1, y1, x2, y2, x3, y3, xp, yp, a, b, c;
 while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
 {
	 a = (x2-x1)*(yp-y1)-(y2-y1)*(xp-x1);
     b = (x3-x2)*(yp-y2)-(y3-y2)*(xp-x2);
     c = (x1-x3)*(yp-y3)-(y1-y3)*(xp-x3);
	 if((a>0&&b>0&&c>0)||(a<0&&b<0&&c<0))
		 cout<<"YES"<<endl;
	 else
		 cout<<"NO"<<endl;
 }
 return 0;
}

C++: #include <iostream>

using namespace std;

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) == 8) {
        double pax = x1 - xp, pay = y1 - yp, pbx = x2 - xp, pby = y2 - yp, pcx = x3 - xp, pcy = y3 - yp;
        double n1 = pax * pby - pay * pbx, n2 = pbx * pcy - pby * pcx, n3 = pcx * pay - pcy * pax;
        if((n1 <= 0.0 && n2 <= 0.0 && n3 <= 0.0) || (n1 > 0.0 && n2 > 0.0 && n3 > 0.0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	double x[4] = {-1000}, y[4] = {-1000},xp,yp;
	double max_x, min_x, max_y, min_y;
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[1], &y[1], &x[2], &y[2], &x[3], &y[3], &xp, &yp) != EOF){
		
		sort(x, x + 3);
		sort(y, y + 3);
		
		max_x = x[3];
		max_y = y[3];
		min_x = x[1];
		min_y = y[1];
		
		if (min_x < xp && xp < max_x && min_y < yp && yp < max_y){
			printf("YES\n");
		}
		else printf("NO\n");
	}
}

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

/* 平面幾何の基本要素 */
 
#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS )
 
class Point { // 点を表すクラス
public:
  double x,y;
  
  Point(double x=0,double y=0): x(x),y(y) {}
  
  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }
  
  double abs() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  
  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
  
  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

typedef Point Vector; // ベクトルを表す構造体

struct Segment { // 線分を表す構造体
  Point p1,p2;
};

typedef Segment Line; // 直線を表す構造体

class Circle { // 円を表すクラス
public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0.0): c(c),r(r) {}
};
typedef vector < Point > Polygon; // 多角形

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

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;
 
int ccw(Point p0, Point p1, 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( a.norm() < b.norm() ) return ONLINE_FRONT;
 
  return ON_SEGMENT;
}

bool intersect(Point p1,Point p2,Point p3,Point p4){
  return ( ccw(p1,p2,p3) * ccw(p1,p2,p4) <= 0 && 
	   ccw(p3,p4,p1) * ccw(p3,p4,p2) <= 0);
}

bool intersect(Segment s1,Segment s2){
  return intersect(s1.p1,s2.p1,s1.p2,s2.p2);
}

int contains(Polygon g,Point p){
  int n = g.size();
  bool x = false;
  for(int i=0;i<n;i++){
    Point a = g[i] - p, b = g[(i+1)%n] - p;
    if(abs(cross(a,b)) < EPS && dot(a,b) < EPS) return 0;
    if(a.y > b.y) swap(a,b);
    if(a.y < EPS && EPS < b.y && cross(a,b) > EPS) x = !x;
  }
  return (x ? 1 : 0);
}

int main(){
  Point p1,p2,p3,p4;
  char o;
  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y){
    Polygon g;
    g.push_back(p1);
    g.push_back(p2);
    g.push_back(p3);
    if(contains(g,p4)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++: //#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	double x[4],y[4],dx[3],dy[3],dpx[3],dpy[3];
	double th[3], pth[3];
	int check = 0;
	bool ans = true;


	while (	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){
		if (x[1] == 0 && y[1] == 0){
			swap(x[0], x[1]);
			swap(y[0], y[1]);
		}
		if (x[2] == 0 && y[2] == 0){
			swap(x[0], x[2]);
			swap(y[0], y[2]);
		}
		if (sin(atan2(y[1]-y[0], x[1]-x[0]) - atan2(y[2]-y[0], x[2]-x[0])) > 0){
			swap(x[1], x[2]);
			swap(y[1], y[2]);
		}

		for (int i = 0; i < 3; i++){
			dx[i] = x[(i + 1) % 3] - x[i];
			dy[i] = y[(i + 1) % 3] - y[i];
			dpx[i] = x[3] - x[i];
			dpy[i] = y[3] - y[i];
			th[i] = atan2(dy[i], dx[i]);
			pth[i] = atan2(dpy[i], dpx[i]);
		}

		for (int i = 0; i < 3; i++){
			if (sin(th[i] - pth[i])>0){
				ans = false;
				break;
			}
		}
		cout << (ans ? "YES" : "NO" )<< endl;
	}
}

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

typedef complex<double> cd;

#define X real()
#define Y imag()

double dot(cd a,cd b){
    return (a*conj(b)).X;
}

double cross(cd a,cd b){
    return -((a*conj(b)).Y);
}

int main(){
    double x,y;

    while(cin>>x>>y){
        vector<cd> v,vec;
        v.push_back(cd(x,y));
        for(int i=1;i<3;i++){
            cin>>x>>y;
            v.push_back(cd(x,y));
        }

        v.push_back(v[0]);

        for(int i=0;i<3;i++){
            vec.push_back(v[i+1]-v[i]);
        }

        cin>>x>>y;

        int all_p=1,all_n=1;
        for(int i=0;i<3;i++){
            int crs=cross(vec[i],cd(x,y)-v[i]);
            all_p &= crs>0;
            all_n &= crs<0;
        }

        if(all_p || all_n){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }

    return 0;
}