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<cstdio>
#define _USE_MATH_DEFINES
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;


#define INF 1e+10
#define EPS 1e-10
#define EQ(a,b) (abs(a-b)<EPS)

//ティツェツ、テ・ツキツョテ」ツつ津ィツ?εヲツ?ョテ」ツ?療」ツ?ヲティツカツウテ」ツ?療ァツョツ?
double add(double a,double b){
	if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
	return a+b;
}
struct P{//2テヲツャツ。テ・ツ?ε」ツδ凖」ツつッテ」ツδ暗」ツδォ
	double x,y;
	P(){}
	P(double x,double y):x(x),y(y){}
	P operator + (P p){
		return P(add(x,p.x),add(y,p.y));
	}
	P operator - (P p){
		return P(add(x,-p.x),add(y,-p.y));
	}
	P operator * (double d){
		return P(x*d,y*d);
	}
	P operator / (double d){
		return P(x/d,y/d);
	}
	double dot(P p){//テ・ツ??ァツゥツ?
		return add(x*p.x,y*p.y);
	}
	double det(P p){//テ・ツ、ツ姪ァツゥツ?
		return add(x*p.y,-y*p.x);
	}
	bool equal(P p){
		return (x-p.x)*(x-p.x)+(y-p.y)*(y-p.y) < EPS*EPS;
	}
};
//typedef pair<P,P> Line;

//テァツキツ堙・ツ按?1-p2テ、ツクツ甘」ツ?ォテァツつケqテ」ツ?古」ツ?づ」ツつ凝」ツ?凝・ツ按、テ・ツョツ?
bool on_seg(P p1,P p2,P q){
	return (p1-q).det(p2-q)==0 && (p1-q).dot(p2-q)<=0;
}
//テァツ崢エテァツキツ嗔1-p2テ」ツ?ィテァツ崢エテァツキツ嘔1-q2テ」ツ?ョテ、ツコツ、テァツつケ
P intersection(P p1,P p2,P q1,P q2){
	return p1+(p2-p1)*( (q2-q1).det(q1-p1)/(q2-q1).det(p2-p1) );
}


//テァツキツ堙・ツ按?1-p2テ」ツ?ィテァツキツ堙・ツ按?1-q2テ」ツ?古、ツコツ、テ・ツキツョテ」ツ?凖」ツつ凝」ツ??
bool exist_intersection(P p1,P p2,P q1,P q2){
	if(on_seg(p1,p2,q1)||on_seg(p1,p2,q2)||on_seg(q1,q2,p1)||on_seg(q1,q2,p2))return true;
	if((p1-p2).det(q1-q2)==0 )return false;//テ・ツケツウティツ。ツ?
	P a=intersection(p1,p2,q1,q2);
	return on_seg(p1,p2,a) && on_seg(q1,q2,a);
}
//テ・ツ篠淌ァツつケテ、ツクツュテ・ツソツε・ツ崢榲ィツサツ「
P rotate(P p,double rad){
	double s=sin(rad),c=cos(rad);
	return P(c*p.x-s*p.y, s*p.x+c*p.y);
}
//originテ」ツつ津、ツクツュテ・ツソツε」ツ?ォテ・ツ崢榲ィツサツ「
P rotate(P p,double rad,P origin){
	return origin + rotate(p - origin,rad);
}
//テ、ツコツ古ァツつケテゥツ鳴禿」ツ?ョティツキツ敕ゥツ崢「
double dist(P p,P q){
	p = p-q;
	return sqrt(p.x*p.x+p.y*p.y);
}
//テ・ツ債佚、ツスツ催」ツδ凖」ツつッテ」ツδ暗」ツδォテ」ツ?ォテ・ツ、ツ嘉ヲツ渉?
P to_unit(P p){
	double d = sqrt(p.x*p.x+p.y*p.y);
	return p/d;
}
//テ・ツ??・ツ青古・ツ」ツォテ」ツ?ョテ、ツコツ、テァツつケテ」ツつ津ィツィツ暗ァツョツ?
pair<P,P> circle_intersection(double x1,double y1,double r1,double x2,double y2,double r2){
	double rad = atan2(y2-y1,x2-x1);
	x2 -= x1;
	y2 -= y1;
	P tmp = rotate(P(x2,y2),-rad);
	x2 = tmp.x;
	y2 = tmp.y;
	double x = (r1*r1-r2*r2+x2*x2)/(2*x2);
	if(abs(r1) < abs(x))return make_pair(P(0,0),P(0,0));//テ、ツコツ、テァツつケテ」ツ?ェテ」ツ??
	double y = sqrt(r1*r1-x*x);
	return make_pair( P(x1,y1)+rotate(P(x,y),rad) ,  P(x1,y1)+rotate(P(x,-y),rad) );
}
//2テァツつケテ」ツつ津ゥツ?堙」ツつ凝・ツ債甘・ツセツвテ」ツ?ョテ・ツ??」ツ?ョテ、ツクツュテ・ツソツε・ツコツァテヲツィツ?
vector<P> circle_on_2P(P p,P q,double r){
	vector<P> res; 
	if(2*r+EPS < dist(p,q))return res;//ティツァツ」テ」ツ?ェテ」ツ??
	if(q.x < p.x)swap(p,q);
	q = q - p;
	double rad = atan2(q.y,q.x);
	P tmp = rotate(q,-rad);
	double x = tmp.x/2;
	double y = sqrt(4*r*r-tmp.x*tmp.x)/2;
	P a = p+rotate(P(x,y),rad) , b = p+rotate(P(x,-y),rad);
	res.push_back(a);
	if(!a.equal(b))res.push_back(b);
	return res;
}
//テァツキツ堙・ツ按?」ツ?ィテァツつケテ」ツ?ョティツキツ敕ゥツ崢「
double dist_LP(P p1,P p2,P q){
	double dx,dy;
	dx = p1.x-p2.x;
	dy = p1.y-p2.y;
	double d = min(dist(p1,q) ,dist(p2,q));
	pair<P,P> normal = make_pair(q+to_unit(P(-dy,dx))*d ,q+to_unit(P(dy,-dx))*d);//テヲツウツ陛ァツキツ堙」ツδ凖」ツつッテ」ツδ暗」ツδォ
	if(exist_intersection(p1,p2,normal.first,normal.second)){
		return dist(q, intersection(p1,p2,normal.first,normal.second));
	}
	return d;
}
//テァツキツ堙・ツ按?ゥツ鳴禿」ツ?ョティツキツ敕ゥツ崢「
double dist_LL(P p1,P p2,P q1,P q2){
	if(exist_intersection(p1,p2,q1,q2))return 0;
	return min( min(dist_LP(p1,p2,q1),dist_LP(p1,p2,q2))
		,min(dist_LP(q1,q2,p1),dist_LP(q1,q2,p2)) );
}
//テ」ツδゥテ」ツつクテ」ツつ「テ」ツδウテ」ツ?ォテ・ツ、ツ嘉ヲツ渉?
double radian(double angle){
	return angle/180.0*M_PI;
}
//テァツつケpテ」ツつ津ゥツ?堙」ツつ凝・ツ??」ツ?ョテヲツ篠・テァツキツ?
pair<P,P> tangent_CP(double x,double y,double r,P p){
	//P q(x,y), m((x+p.x)/2,(y+p.y)/2);
	double d=sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y))/2;
	return circle_intersection(x,y,r,(x+p.x)/2,(y+p.y)/2,d);
}

int main(){
	P p,q,r,c;
	while(cin>>p.x>>p.y>>q.x>>q.y>>r.x>>r.y>>c.x>>c.y){
		bool a=false,b=false;
		a |= exist_intersection(c,c+P(100.0,0.0),p,q);
		a |= exist_intersection(c,c+P(100.0,0.0),q,r);
		a |= exist_intersection(c,c+P(100.0,0.0),r,p);
		b |= exist_intersection(c,c+P(-100.0,0.0),p,q);
		b |= exist_intersection(c,c+P(-100.0,0.0),q,r);
		b |= exist_intersection(c,c+P(-100.0,0.0),r,p);
		cout<<(a&&b?"YES":"NO")<<endl;
	}
	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

#define v2d Vector2D

struct Vector2D {
	double x, y;
};

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

double out_mul(Vector2D a, Vector2D b) {
	return a.x*b.y - a.y*b.x;
}

bool point_in_triangle_2D(v2d a, v2d b, v2d c, v2d p) {
	v2d ab = sub_vector2D(b, a);
	v2d bp = sub_vector2D(p, b);

	v2d bc = sub_vector2D(c, b);
	v2d cp = sub_vector2D(p, c);

	v2d ca = sub_vector2D(a, c);
	v2d ap = sub_vector2D(p, a);

	double c1 = out_mul(ab, bp), c2 = out_mul(bc, cp), c3 = out_mul(ca, ap);

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

int main() {
	v2d a, b, c, p;

	while (cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y) {
		if (point_in_triangle_2D(a, b, c, p)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],x[2],m[2][2],ans[2],inv[2][2],det,s,t;
  while(cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>x[0]>>x[1]){
    m[0][0] = b[0]-a[0];
    m[1][0] = b[1]-a[1];
    m[0][1] = c[0]-a[0];
    m[1][1] = c[1]-a[1];
    ans[0] = x[0]-a[0];
    ans[1] = x[1]-a[1];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    inv[0][0] = m[1][1]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[1][1] = m[0][0]/det;
    s = ans[0]*inv[0][0]+ans[1]*inv[0][1];
    t = ans[0]*inv[1][0]+ans[1]*inv[1][1];
    if(s>0 && t>0 && s+t<1){cout <<"YES"<<endl;}
    else{cout <<"NO"<<endl;}
  }
  return 0;
}