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 <cmath>

using namespace std;

double get2pDist(double, double, double, double);
double getplDist(double, double, double, double, double, double);
double getTriangle(double, double, double, double, double, double);

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		double S = getTriangle(x1, y1, x2, y2, x3, y3);
		double s =
			getTriangle(x1, y1, x2, y2, xp, yp)
			+ getTriangle(x2, y2, x3, y3, xp, yp)
			+ getTriangle(x3, y3, x1, y1, xp, yp);
		abs(S - s) < 0.0001 ? cout << "YES" : cout << "NO";
	}
	return 0;
}

double get2pDist(double x1, double y1, double x2, double y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));	
}

double getplDist(double x, double y, double x1, double y1, double x2, double y2){
	double a, b, c;
	a = y1 - y2;
	b = x2 - x1;
	c = x1 * y2 - x2 * y1;
	return abs(a * x + b * y + c) / sqrt(a * a + b * b);
}

double getTriangle(double x1, double y1, double x2, double y2, double x3, double y3){
	return (get2pDist(x1, y1, x2, y2)
	 * getplDist(x3, y3, x1, y1, x2, y2)) / 2;
}

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

double x[4],y[4];
string judge ();

int main() {
	while ( cin >> x[0] ) {
		for( int i = 0; i < 4; i++ ){
			if ( !i )
				cin >> y[i];
			else
				cin >> x[i] >> y[i];
		}
		
		cout << endl <<  judge () << endl;
		
	}
	return 0;
}

string judge () {
	string res;
	
	for ( int i = 0; i < 3; i++ ){
		int next;
		if ( i == 2 ) 
			next = '0';
		else
			next = i + 1;
		if ( x[i] < x[next] && x[i] > x[3] || x[i] > x[next] && x[i] < x[3] )
			return "NO";
		if ( y[i] < y[next] && y[i] > y[3] || y[i] > y[next] && y[i] < y[3] )
			return "NO";
	}
	return "YES";
}

C++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(all(v),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

double EPS = 1e-10;
double add(double a, double b){
  if(abs(a+b) < EPS* (abs(a) + abs(b))) return 0;
  return a+b;
}
struct P{
  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);
  }
  double dot(P p){
    return add(x * p.x,y*p.y);
  }
  double det(P p){
    return add(x*p.y,-y*p.x);
  }
  double dist2(P p){
    return ((*this-p).x * (*this-p).x) + ((*this-p).y * (*this-p).y);
  }
  double GetSlope(P &p){
    P tmp = *this - p;
    return tmp.y/tmp.x;
  }
};
//???????????????????????¨?????????
bool on_seg(P p1,P p2,P q){
  return (p1-q).det(p2-q) == 0 && (p1-q).dot(p2-q) <= 0;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,c,d,e,f,xp,yp;
  while(cin >> a >> b >> c >> d >> e >> f >> xp >> yp){
    bool flag = true;
    double acx = c-a,abx = e-a,acy = d-b,aby = f-b,apx = xp-a,apy = yp - b;
    P p1 = P(a,b),p2 = P(c,d),p3 = P(e,f),p4 = P(xp,yp);
    double t,s;
    if(acx == 0){
      s = apx/ abx;
      t = (apy - s * aby)/acy;
    }
    else if(acy == 0){
      s = apy/aby;
      t = (apx - s * abx)/acx;
    }
    else if(abx == 0){
      t = apx / acx;
      s = (apy- t * acy)/aby;
    }
    else if(aby == 0){
      t = apy/acy;
      s = (apx - t * acx)/abx;
    }
    else{
//       t = (abx * apy - apx * aby)/(acy - acx*aby);
      t = (apy * abx - aby * apx)/(acy * (abx - aby) - (acx - acy));
//       s = (apx - t * acx)/abx;
      s = ((apx - apy) - t * (acx - acy))/(abx - aby);
    }
    if(on_seg(p1,p2,p4) || on_seg(p1,p3,p4) || on_seg(p2,p3,p4)){
      flag = false;
    }
    else{
      flag = 0 < t+s && t+s < 1 && s > 0 && t > 0;
    }
    Ans(flag);
  }
  return 0;
}

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

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std{
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}
bool in_triangle(const P& p1,const P& p2,const P& p3,const P& p){
	return cross(p2-p1,p-p1)>0 && cross(p3-p2,p-p2)>0 && cross(p1-p3,p-p3)>0;
}
int main(){
	double x1,y1,x2,y2,x3,y3,x,y;
	for(;~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x,&y);){
		P p1(x1,y1),p2(x2,y2),p3(x3,y3),p(x,y);
		bool in=in_triangle(p1,p2,p3,p)||in_triangle(p2,p1,p3,p);
		puts(in?"YES":"NO");
	}
}

C++: #include<iostream>
using namespace std;
int main()
{
double x;
double x1,y1,x2,y2,x3,y3,xp,yp;
int S=0;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
{
	if(y1<y2&&y3<y2)
	{
	for(double i=x1;i<=x3;i+=0.0001)
{
x=i;
if((y1-y2)/(x1-x2)*x+y1-(y1-y2)/(x1-x2)*x1>(y1-y2)/(x1-x2)*xp+y1-(y1-y2)/(x1-x2)*x1&&(y2-y3)/(x2-x3)*x+y2-(y2-y3)/(x2-x3)*x2>(y2-y3)/(x2-x3)*xp+y2-(y2-y3)/(x2-x3)*x2&&(y1-y3)/(x1-x3)*x+y1-(y1-y3)/(x1-x3)*x2<(y1-y3)/(x1-x3)*xp+y1-(y1-y3)/(x1-x3)*x1)
{
	S++;
cout<<"YES"<<endl;
break;	
}
}
}
else if(y1>y2&&y1>y1)
{
for(double i=x1;i<=x3;i+=0.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