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 <algorithm>
#include <vector>
#include <functional>
#include <sstream>
#include <cstdio>
using namespace std;

// A Point in a Triangle(0012)
double area(const double x1, const double y1, const double x2, const double y2, const double x3, const double y3)
{
	double s = x1*y2 - x1*y3 + x2*y3 - x2*y1 + x3*y1 - x3*y2;
	if (s < 0)
		s = -s;
	return s / 2.0;
}

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		double St = area(x1, y1, x2, y2, x3, y3);

		double S1 = area(x1, y1, x2, y2, xp, yp);
		double S2 = area(x2, y2, x3, y3, xp, yp);
		double S3 = area(x3, y3, x1, y1, xp, yp);

		if (S1 != 0 && S2 != 0 && S3 != 0 && S1+S2+S3 == St)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

// テァツつケテ・ツコツァテヲツィツ凖」ツつ津・ツ楪凝」ツ?ィテ」ツ?凖」ツつ?
typedef complex<double> P;
// テ渉?」ツ?ョテ・ツョツ堙ァツセツゥ
#define PI 3.1415926535898

// ティツィツアテ・ツョツケテ」ツ?凖」ツつ凝ィツェツ、テ・ツキツョテ篠オ
#define EPS (1e-10)
//XYテ・ツコツァテヲツィツ?
#define X real()
#define Y imag()

//テッツシツ津」ツ?、テ」ツ?ョdoubleテ・ツ楪凝」ツ?ョテヲツ閉ーテ・ツ?、テ」ツ?古ァツュツ嘉」ツ?療」ツ??」ツ?凝」ツ?ゥテ」ツ??」ツ??
bool equal(double a, double b){
	return ( abs( a-b ) < EPS )? true : false ;
}
	
// テ、ツクツ嘉ィツァツ津・ツスツ「テ」ツつッテ」ツδゥテ」ツつケ
class Triangle{

private:
	//テ、ツクツ嘉ィツァツ津・ツスツ「テ」ツ?ョテッツシツ禿ァツつケテ」ツ?ョテ・ツコツァテヲツィツ?
	P a, b, c;
	//テ、ツクツ嘉ィツァツ津・ツスツ「テ」ツ?ョテッツシツ禿ィツセツコテ」ツ?ョテゥツ閉キテ」ツ??
	double edgeA,edgeB,edgeC;
	//テ、ツクツ嘉ィツァツ津・ツスツ「テ」ツ?ョテッツシツ禿ィツァツ津」ツ?ョテ・ツ、ツァテ」ツ?催」ツ??テ」ツδゥテ」ツつクテ」ツつ「テ」ツδウ)
	double angleA,angleB,angleC;
	//テ、ツスツ凖・ツシツヲテ・ツョツ堙ァツ青?」ツ?凝」ツつ嘉ッツシツ禿」ツ?、テ」ツ?ョティツァツ津・ツコツヲテ」ツつ津ヲツアツづ」ツつ?」ツつ凝ゥツ鳴「テヲツ閉ー
	double LawOfCosines(double a,double b, double c){
		return acos( (b*b+c*c-a*a) / (2.0*b*c) );
	}
	
public:
	//テ」ツつウテ」ツδウテ」ツつケテ」ツδ暗」ツδゥテ」ツつッテ」ツつソ(テッツシツ禿」ツ?、テ」ツ?ョテァツつケテ」ツ?ィティツセツコテ」ツ?ィティツァツ津・ツコツヲテ」ツつ津・ツ按敕ヲツ慊淌・ツ個?
	Triangle(P p1, P p2, P p3){
		a = p1;
		b = p2;
		c = p3;
		edgeB = abs(c-a);
		edgeA = abs(b-c);
		edgeC = abs(a-b);
		angleA = LawOfCosines(edgeA,edgeB,edgeC);
		angleB = LawOfCosines(edgeB,edgeC,edgeA);
		angleC = LawOfCosines(edgeC,edgeA,edgeB);
	}
	double getAngleC(){//ティツァツ辰テ」ツ?ョティツァツ津・ツコツヲテ」ツつ津・ツ、ツ嘉」ツ?暗」ツ??
		return angleC;
	}
};

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

	while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ){
		P a( x1 , y1 );
		P b( x2 , y2 );
		P c( x3 , y3 );
		P p( xp , yp );
		Triangle Tr1(a,b,p);
		Triangle Tr2(b,c,p);
		Triangle Tr3(c,a,p);
		angle = Tr1.getAngleC() + Tr2.getAngleC() + Tr3.getAngleC();
		( equal( 2.0*PI , angle) )? cout << "YES" : cout << "NO" ;
		cout << endl;
	}
}

C++: #include <iostream>
#include <cmath>
#define EPS (1.0e-8)

using namespace std;
 
int main() {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  double a[2], b[2];
  double A, B;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    a[0] = x2 - x1;
    a[1] = y2- y1;
    b[0] = x3 - x1;
    b[1] = y3 - y1;
    if(fabs(a[0] * b[0] + a[1] * b[1]) != 1) {
      A = (b[1] * (xp - x1) - b[0] * (yp - y1)) / (a[0] * b[1] - b[0] * a[1]);
      B = (a[1] * (xp - x1) - (yp - y1) * a[0]) / (a[1] * b[0] - b[1] * a[0]);
      if ((A+B < 1) && (A > 0) && (B > 0)) {
        cout << "YES" << endl;
      }
      else {
        cout << "NO" << endl;
      }
    }
    else
      cout << "NO" << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

struct point{ double x, y; };

point sub(const point& a, const point& b){
  point ret;
  ret.x = a.x - b.x;
  ret.y = a.y - b.y;
  return ret;
}

int solve(point a, point b, point c, point p){
  point ab = sub(b, a), bp = sub(p, b);
  point bc = sub(c, b), cp = sub(p, c);
  point ca = sub(a, c), ap = sub(p, a);

  double c1 = ab.x * bp.y - ab.y * bp.x;
  double c2 = bc.x * cp.y - bc.y * cp.x;
  double c3 = ca.x * ap.y - ca.y * ap.x;

  if((c1 > 0 && c2 > 0 && c3 > 0) || (c1 < 0 && c2 < 0 && c3 < 0)) return 1;
  return 0;
}

int main(){
  double x1, x2, x3, xp, y1, y2, y3, yp;
  while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)){
    point a, b, c, P;
    a.x = y1; a.y = x1;
    b.x = y2; b.y = x2;
    c.x = y3; c.y = x3;
    P.x = yp; P.y = xp;

    if(solve(a, b, c, P)) puts("YES");
    else puts("NO");
  }
  return 0;
}

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

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

    // 上下左右の判定
    bool under = false;
    bool top = false;
    bool side[2] = {false};
    for(int i = 0; i < 3; i++){
      if(y[i] > 0){
	under = true;
      }
      if(y[i] < 0){
	top = true;
      }
      if(x[i] > 0){
	side[0] = true;
      }
      if(x[i] < 0){
	side[1] = true;
      }
    }

    if(under && top && side[0] && side[1]){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
  return 0;
}