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>
using namespace std;
int main()
{
long double x;
long double x1,y1,x2,y2,x3,y3,xp,yp;
int S=0;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
{
	if(y1<y2&&y3<y2)
	{
	for(long double i=x1;i<=x3;i+=0.0001)
{
x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1>(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2>(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2<(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;	
}
}
}
else if(y1>y2&&y1>y1)
{
for(long double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1>(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2<(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2>(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;	
	}	
	}	
}
else if(y3>y1&&y3>y2)
{
	for(long double i=x1;i<=x3;i+=0.0001)
{x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1<(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2>(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2>(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;
}
}
}

{
if(S<1)
{
 	cout<<"NO"<<endl;
 }
}
}
return 0;
}

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

using namespace std;

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
#define dle(a,b) (equals(a, b) || a < b)
static const double PI = acos(-1);

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(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;

class Segment {
public:
  Point p1, p2;
  Segment(Point s = Point(), Point t = Point()): p1(s), p2(t) {}
};

double norm( Vector a ) { return a.x*a.x + a.y*a.y; }
double abs( Vector a ) { return sqrt(norm(a)); }
double getDistance( Vector a, Vector b ) { return a.x*b.x + a.y*b.y; }
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( norm(a) < norm(b) ) return ONLINE_FRONT;
  return ON_SEGMENT;
}

int main() {
  double x1, y1, x2, y2, x3, y3, x, y;
  
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y) {
    int ccw1 = ccw( Point(x1,y1), Point(x2,y2), Point(x,y) );
    int ccw2 = ccw( Point(x2,y2), Point(x3,y3), Point(x,y) );
    int ccw3 = ccw( Point(x3,y3), Point(x1,y1), Point(x,y) );
    if( ccw1 == ccw2 && ccw2 == ccw3 ) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

class Point{
public:
	double x;
	double y;
	Point(double _x, double _y) : x(_x), y(_y) {}
};

bool isInterSect(const Point& p1,const Point& p2,const Point& p3,const Point& p4){
	    if (((p1.x - p2.x) * (p3.y - p1.y) + (p1.y - p2.y) * (p1.x - p3.x)) * 
        ((p1.x - p2.x) * (p4.y - p1.y) + (p1.y - p2.y) * (p1.x - p4.x)) < 0){
			if (((p3.x - p4.x) * (p1.y - p3.y) + (p3.y - p4.y) * (p3.x - p1.x)) * 
            ((p3.x - p4.x) * (p2.y - p3.y) + (p3.y - p4.y) * (p3.x - p2.x)) < 0){
				return true;
			}
		}

		return false;
}

int main(){
	double x1,y1,x2,y2,x3,y3;
	double xp,yp;
	while(~scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)){
		double mx = (x1+x2+x3)/3.0;
		double my = (y1+y2+y3)/3.0;
		if(!isInterSect(Point(x1,y1),Point(x2,y2),Point(xp,yp),Point(mx,my))
			&& !isInterSect(Point(x2,y2),Point(x3,y3),Point(xp,yp),Point(mx,my))
			&& !isInterSect(Point(x3,y3),Point(x1,y1),Point(xp,yp),Point(mx,my))){
				printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
}

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

using namespace std;

int main(){
  double x[3], y[3], p[2];

  while(cin >> x[0] >> y[0]){
    for(int i = 1; i < 3; i++){
      cin >> x[i] >> y[i];
    }
    cin >> p[0] >> p[1];

    // pを(0,0)として三角形の位置をづらす
    for(int i = 0; i < 3; i++){
      x[i] -= p[0];
      y[i] -= p[1];
    }

    // 辺の長さ
    double triEdge[3];
    double pEdge[3];
    // 12 23 31
    for(int i = 0; i < 3; i++){
      triEdge[i] = sqrt(pow(x[i % 3] - x[(i + 1) % 3], 2)
		     + pow(y[i % 3] - y[(i + 1) % 3], 2));
    }

    // 1p 2p 3p
    for(int i = 0; i < 3; i++){
      pEdge[i] = sqrt(pow(x[i], 2) + pow(y[i], 2));
    }
    
    // ヘロンの公式
    double s;
    double ans;
    // 123の面積
    s = (triEdge[0] + triEdge[1] + triEdge[2]) / 2;
    ans = sqrt(s * (s - triEdge[0])*(s - triEdge[1])
	       *(s - triEdge[2]));

    double area;
    // p12の面積
    s = (triEdge[0] + pEdge[0] + pEdge[1]) / 2;
    area = sqrt(s * (s - triEdge[0])*(s - pEdge[0])
	       *(s - pEdge[1]));

    // p13の面積
    s = (pEdge[0] + pEdge[2] + triEdge[2]) / 2;
    area += sqrt(s * (s - pEdge[0])*(s - pEdge[2])
	       *(s - triEdge[2]));

    // p23の面積
    s = (pEdge[1] + triEdge[1] + pEdge[2]) / 2;
    area += sqrt(s * (s - pEdge[1])*(s - triEdge[1])
	       *(s - pEdge[2]));
    
    if(fabs(ans - area) < 0.00001){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
    
   
  }
  return 0;
}