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;

int main() {
    double x[3], y[3], xp, yp, a, b, c, d;
    while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp) {
        int cnt = 0;
        for (int i=0; i<3; ++i) {
            a = x[(i+1)%3] - x[i];
            b = y[(i+1)%3] - y[i];
            c = xp - x[i];
            d = yp - y[i];
            if (0 < a * d - b * c) cnt ++;
        }
        cout << (cnt % 3 ? "NO" : "YES") << endl;
    }
    return 0;
}

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