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 <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iterator>
#include<math.h>
#define debug() puts("what the fuck")
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
int main()
{
    double ax,ay,bx,by,cx,cy,px,py,mx,my,nx,ny,a1x,a1y,b1x,b1y,c1x,c1y;
    while(cin>>ax>>ay>>bx>>by>>cx>>cy>>px>>py)
    {
        mx=bx-ax;my=by-ay;
        nx=cx-ax;ny=cy-ay;
        a1x=ax-px;a1y=ay-py;
        b1x=bx-px;b1y=by-py;
        c1x=cx-px;c1y=cy-py;
        if(abs(abs(mx*ny-my*nx)-(abs(a1x*b1y-b1x*a1y)+abs(a1x*c1y-c1x*a1y)+abs(c1x*b1y-b1x*c1y)))<=1e-6)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;

    }

    return 0;
}

C++: #include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

bool isAbove(pair<double, double> p1, pair<double, double> p2, pair<double, double> p3) {
	if (p1.first == p2.first) {
		return p3.first > p1.first;
	} else {
		return p3.second > p1.second + (p2.second - p1.second) * (p3.first - p1.first) / (p2.first - p1.first);
	}
}

void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif

	vector<pair<double, double>> vertices(4);
	while (cin >> vertices[0].first) {
		cin >> vertices[0].second;
		rep(i, 3) cin >> vertices[i + 1].first >> vertices[i + 1].second;

		bool flag = (isAbove(vertices[0], vertices[1], vertices[2]) == isAbove(vertices[0], vertices[1], vertices[3]));
		flag &= (isAbove(vertices[0], vertices[2], vertices[1]) == isAbove(vertices[0], vertices[2], vertices[3]));
		flag &= (isAbove(vertices[1], vertices[2], vertices[0]) == isAbove(vertices[1], vertices[2], vertices[3]));

		cout << (flag ? "YES" : "NO") << endl;
	}


}




int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	solve();
	system("PAUSE");
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#define EPS 1e-10
using namespace std;

int main(){
  double x1,x2,x3,xp,y1,y2,y3,yp;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
    double A = sqrt(pow(x1-x2,2)+pow(y1-y2,2)),B = sqrt(pow(x2-x3,2)+pow(y2-y3,2)), C = sqrt(pow(x1-x3,2)+pow(y1-y3,2)) ;
    double s = (A+B+C)/2.0;
    double S = sqrt(s*(s-A)*(s-B)*(s-C));
 
   double A12 = sqrt(pow(x1-x2,2)+pow(y1-y2,2)),B1p =sqrt(pow(x1-xp,2)+pow(y1-yp,2)), C2p = sqrt(pow(xp-x2,2)+pow(yp-y2,2)) ;
    double s2 = (A12+B1p+C2p)/2.0;
    double S2 = sqrt(s2*(s2-A12)*(s2-B1p)*(s2-C2p));
    /*
    if(S2 == 0){
      cout << "NO" << endl;
      break;
    }
    */
    double A13 = sqrt(pow(x1-x3,2)+pow(y1-y3,2)), Cp3 = sqrt(pow(xp-x3,2)+pow(yp-y3,2));
    double s3 = (A13+B1p+Cp3)/2.0;
    double S3 =  sqrt(s3*(s3-A13)*(s3-B1p)*(s3-Cp3));
    /*
    if(s3 == 0){
      cout << "NO" << endl;
      break;
    }
    */
    double A23 = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
    double s4 = (A23+C2p+Cp3)/2.0;
    double S4 =  sqrt(s4*(s4-A23)*(s4-C2p)*(s4-Cp3));
    /*
    if(S3 == 0){
      cout << "NO" << endl;
      break;
    }
    */
    double Ssum = S2+S3+S4;
    
    fabs(Ssum - S)< EPS?cout << "YES" << endl:cout << "NO" << endl;


  }
  return 0;
}

C++: #include<stdio.h>
int main(void) {
   double x1, x2, x3, xp, y1, y2, y3, yp, key;
   while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF ) {
       if ( x2 < x1 && x1 < x3 ) {
           key = x1;
           x1 = x2;
           x2 = key;
       } else if ( x2 < x3 && x3 < x1 ) {
           key = x3;
           x3 = x1;
           x1 = x2;
           x2 = key;
       } else if ( x3 < x1 && x1 < x2 ) {
           key = x1;
           x1 = x3;
           x3 = x2;
           x2 = key;
       } else if ( x3 < x2 && x2 < x1 ) {
           key = x1;
           x1 = x3;
           x3 = key; 
       } else if ( x1 < x3 && x3 < x2 ) {
           key = x3;
           x3 = x2;
           x2 = key;
       }
       /*???????????§?????????*/
       /*?????????????????¬???*/
       if ( xp < x1 ) printf("NO\n");
       else if ( x3 < xp ) printf("NO\n");
       else if ( x1 < xp && xp < x2 ) {
           
       }
       printf("%lf %lf %lf\n", x1, x2, x3);
   }
   return 0;
}

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

double length(double, double, double, double);

double triangle(double x1, double y1, double x2, double y2, double x3, double y3) {
    double a = length(x1, y1, x3, y3);
    double b = length(x2, y2, x3, y3);
    double c = length(x1, y1, x2, y2);

    double d = (a + b - c) / sqrt(a * b) / 2.0; // cos(radian)

    // cout << d << endl;

    return d;
}

double length(double x, double y, double ox, double oy) {
    return pow(x - ox, 2) + pow(y - oy, 2);
}

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        double ta = triangle(x1, y1, x2, y2, xp, yp);
        double tb = triangle(x1, y1, x3, y3, xp, yp);
        double tc = triangle(x2, y2, x3, y3, xp, yp);

        if (ta < 0 && tb < 0 && tc < 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}