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>
#include <math.h>
using namespace std;
double getCross( double x1, double y1, double x2, double y2 )
{
	return x1 * y2 - y1 * x2;
}
bool same( double a, double b )
{
	if ( a >= 0 && b >= 0 )
		return true;
	if ( a <= 0 && b <= 0 )
		return true;
	return false;
}
int main( void )
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while ( cin >> x1 >> y1 >> x2 >> y2>> x3 >> y3 >> xp >> yp )
	{
		double a = getCross( xp-x1, yp-y1, xp-x2, xp-y2 );
		double b = getCross( xp-x2, yp-y2, xp-x3, yp-y3 );
		double c = getCross( xp-x3, yp-y3, xp-x1, yp-y1 );

		if ( same( a, b ) && same( b, c ) && same( c, a ) )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;

	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> paii;
typedef complex<double> P;

double ccw(P& p1, P& p2, P& p3)
{
	return ((p2.real() - p1.real())*(p3.imag() - p1.imag()) 
				- (p2.imag() - p1.imag())*(p3.real() - p1.real())) > 0;
}// ccw>0 ...ccw, ccw=0 ...colinear, ccw<0 ...cw

int main()
{
	double x, y;
	P p1, p2, p3, px;
	
	while(cin >> x, !cin.eof())
	{
		cin >> y;
		p1 = P(x, y);
		cin >> x >> y;
		p2 = P(x, y);
		cin >> x >> y;
		p3 = P(x, y);
		cin >> x >> y;
		px = P(x, y);
		
		if( ccw(p1, p2, px) > 0 && ccw(p2, p3, px) > 0 && ccw(p3, p1, px) > 0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pt", "r", stdin);
	string str = "";

	while (getline (cin, str )){
		if (str.empty() ){
			break;
		} // end if

		vector <double> tpx (3, 0.);
		vector <double> tpy (3, 0.);
		double px = 0.;
		double py = 0.;
		int i;
	
		stringstream ss(str);
		for (i = 0; i < 3; ++i){
			ss >> tpx[i] >> tpy[i];
		} // end for
		ss >> px >> py;
		 
		vector <double> vx(3, 0.);
		vector <double> vy(3, 0.);
		vector <double> vpx(3, 0.);
		vector <double> vpy(3, 0.);

		for (i = 0; i < 3; ++i){
			vx[i] = tpx[(i+1) % 3] - tpx[i];
			vy[i] = tpy[(i+1) % 3] - tpy[i];
		} // end for
		for (i = 0; i < 3; ++i){
			vpx[i] = px - tpx[i];
			vpy[i] = py - tpy[i];
		} // end for
		
		vector <double> D(3, 0.);
		for (i = 0; i < 3; ++i){
			D[i] = (vx[i]*vpy[i] - vy[i]*vpx[i]);
		} // end for

		for (i = 0; i < 3; ++i){
			if (D[i] >= 0.0){
				continue;
			}else{
				cout << "NO" << endl;
				break;
			} // end if
		} // end for
		if (i == 3){
			cout << "YES" << endl;
		} // end if 
	
	} // end while
		
	return 0;
}

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

int main(){

	typedef struct{
		double x, y;
	}_point;

	double a, b, s, t, r_p3, r_p2, eps;
	_point p1, p2, p3, p;
	
	eps = 10e-12;

  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p.x >> p.y){
		p2.x -= p1.x;
		p2.y -= p1.y;
		p3.x -= p1.x;
		p3.y -= p1.y;
		p.x -= p1.x;
		p.y -= p1.y;
		r_p2 = sqrt(p2.x * p2.x + p2.y * p2.y);
		r_p3 = sqrt(p3.x * p3.x + p3.y * p3.y);
		if(p2.x > eps){
			s = p.y - p.x * p2.y / p2.x;
			t = p3.y - p3.x * p2.y / p2.x;
			a = (s / t);
			b = (p.x - a * p3.x) / p2.x;
		}
		else {
			a = p.x / p3.x;
			b = (p.y - a * p3.y) / p2.y;
		}

		if(a > 0.0 && b > 0.0 && a + b < 1.0) cout << "YES" << endl;
		else cout << "NO" << endl;
  }

  return 0;
}

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

int sign(float n){
	if(n < 0)return -1;
	else if(n > 0)return 1;
	return 0;
}

float angle(float ax, float ay, float bx, float by, float cx, float cy){
    //angle between ab and ac
    float ab = atan2(by-ay,bx-ax);
    float ac = atan2(cy-ay,cx-ax);
    if(ab < 0)ab += 2*M_PI;
    if(ac < 0)ac += 2*M_PI;
    float ang = ac - ab;
    return (fabs(ang) < M_PI ? ang : -sign(ang) * 2 * M_PI + ang) * 180 / M_PI;
}

bool isPointInPolygon(complex< float > a, vector< complex< float > > p){
	int n = p.size();
	float sum = 0;
	
	for(int i = 0; i < n; ++i){
		sum += angle(a.real(), a.imag(), p[i].real(), p[i].imag(), p[(i+1)%n].real(), p[(i+1)%n].imag());
	}
	
	if(abs(sum) >= 300){ //if sum is 360
		return true;
	}
	return false; //if sum is 0
}

int main(){
	float x1, y1, x2, y2, x3, y3 , xp, yp;
	vector< complex< float > > triangle;
	complex< float > point;
	
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		point = complex< float >(xp, yp);
		triangle.push_back(complex< float >(x1, y1));
		triangle.push_back(complex< float >(x2, y2));
		triangle.push_back(complex< float >(x3, y3));
		
		if(isPointInPolygon(point, triangle))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

C++: #include<iostream>
#include<cmath>
#define EPS 0.00000001
using namespace std;
int equals(double x,double y){ return (abs(x-y)<EPS);}
double S3(double,double,double,double,double,double);
int main(){
  double x1,x2,x3,y1,y2,y3,xp,yp;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
    if(equals(
	      S3(x1,y1,x2,y2,xp,yp)+S3(x2,y2,x3,y3,xp,yp)+S3(x1,y1,x3,y3,xp,yp)
	      ,S3(x1,y1,x2,y2,x3,y3)
	      
	      ))
      cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  
  return 0;
}
double S3( double x1, double y1, double x2,double y2, double x3, double y3 ){

  double sum = 0;
  sum = ( x1*y2 - x2*y1 ) + ( x2*y3 - x3*y2 ) + ( x3*y1 - x1*y3 );
  sum = abs(sum);
  sum /= 2;
  
  return sum;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  float x1,y1,x2,y2,x3,y3,xp,yp;
  float a,b,c,d,e,f,s1,s2,t1,t2;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    t2 = 0;
    a = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
    b = sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    c = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    s1 = (a+b+c)/2.0; // 3辺を頂点とする三角形の面積
    t1 = sqrt(s1*(s1-a)*(s1-b)*(s1-c));
    d = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));
    e = sqrt((x3-xp)*(x3-xp)+(y3-yp)*(y3-yp));
    f = sqrt((x2-xp)*(x2-xp)+(y2-yp)*(y2-yp));
    s2 = (a+e+f)/2; 
    t2 += sqrt(s2*(s2-a)*(s2-e)*(s2-f));
    s2 = (b+d+e)/2; 
    t2 += sqrt(s2*(s2-b)*(s2-d)*(s2-e));
    s2 = (c+d+f)/2; 
    t2 += sqrt(s2*(s2-c)*(s2-d)*(s2-f));
    if( t1 >= t2){
      cout << "YES" << endl;
    }else {
      cout << "NO" << endl;
    }
  }
}