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>
using namespace std;
typedef double d;
d cross(d x1,d y1,d x2,d y2){
	return (x1 * y2) - (y1 * x2);
}

int main(){
  d x[3],y[3],xp,yp;
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
    d ret[3];
    for(int i = 0;i<3;i++){
      int nx =(i + 1) % 3;
      ret[i]=cross(xp- x[i],yp - y[i], x[nx] - x[i] ,y[nx] - y[i]);
    }
    if((ret[0] < 0 && ret[1] < 0 && ret[2] < 0) ||  
       (ret[0] > 0 && ret[1] > 0 && ret[2] > 0) ){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

class Vector2{
public:
	Vector2(){}
	Vector2( double aX, double aY ) : x( aX ), y( aY ){}

	double dot( Vector2& a ){
		return ( x * a.x ) + ( y * a.y );
	}

	double x;
	double y;
};


int main(){
	Vector2 p0, p1, p2, q;

	cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> q.x >> q.y;
	bool isInner = false;
	Vector2 a( p1.x - p0.x, p1.y - p0.y );
	Vector2 b( p2.x - p0.x, p2.y - p0.y );
	Vector2 c( q.x - p0.x, q.y - p0.y );

	double aa = a.dot( a );
	double ab = a.dot( b );
	double ac = a.dot( c );
	double bb = b.dot( b );
	double bc = b.dot( c );

	double s = ( bc*ab - ac*bb ) / ( ab*ab - aa*bb );
	if ( ( s > 0.0 ) && ( s < 1.0 ) ){
		double t = ( ac*ab - bc*aa ) / ( ab*ab - aa*bb );
		if ( ( t > 0.0 ) && ( s + t < 1.0 ) ){
			isInner = true;
		}
	}

	cout << ( isInner ? "Yes" : "No" ) << endl;

	return 0;
}

C++: 	#include <cstdio>
	#include <iostream>
	#include <math.h>

	using namespace std;
	#define rep(i,n) for(int i = 0; i < (n); ++i)

	bool judge(double x[2], double y[2]) {
		double cross = x[0] * y[1] - y[0] * x[1];
		if(cross >= 0) return true;
		else return false;
	}

	int main() {
		double x1, y1, x2, y2, x3, y3, xp, yp;
		while(scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
			double x[2], y[2];
			x[0] = x2 - x1;
			y[0] = y2 - y1; 
			x[1] = xp - x1;
			y[1] = yp - y1;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x3 - x2;
			y[0] = y3 - y2;
			x[1] = xp - x2;
			y[1] = yp - y2;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			x[0] = x1 - x3;
			y[0] = y1 - y3;
			x[1] = xp - x3;
			y[1] = yp - y3;
			if(!judge(x, y)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;
		}
		return 0;
	}

C++: #include<iostream>

using namespace std;

int main(){
	double x1, y1, x2, y2, x3, y3, px, py;
	double det, s, t;

	// 入力の終わりまでループ
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py){
		// 係数行列の行列式を計算
		det = ((x2 - x1) * (y3 - y1)) - ((x3 - x1) * (y2 - y1));
		// 係数行列の行列式が0でないことを確かめる
		if(det == 0){
			cerr << "行列式の値が0です" << endl;
			return -1;
		}

		// s, t の値を求める
		s = (((y3 - y1) * (px - x1)) + ((x1 - x3) * (py - y1))) / det;
		t = (((y1 - y2) * (px - x1)) + ((x2 - x1) * (py - y1))) / det;

		// 結果の判定・表示
		if((s > 0) && (s < 1) && (t > 0) && (t < 1) && ((s + t) < 1)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
double x
{
double x1,y1,x2,y2,x3,y3,xp,yp;
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))
{
cout<<"YES"<<endl;
break;	
}
}
else if(y1>y2&&y1>y1)
{
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))
{
cout<<"YES"<<endl;
break;	
	}	
	}	
}
else if(y3>y1&&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))
{
cout<<"YES"<<endl;
break;
}
else
{
	cout<<"NO"<<endl;
}
return 0;
}

C++: #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
double x,y,t=0.001;

double ka(double a,double b,double c,double d) {
	double e,f,g;
	e=sqrt((a-c)*(a-c)+(b-d)*(b-d));
	f=sqrt((a-x)*(a-x)+(b-y)*(b-y));
	g=sqrt((c-x)*(c-x)+(d-y)*(d-y));
	return 180*acos((f*f+g*g-e*e)/(2*f*g))/3.141592;
}

int main() {
	double s,a,b,c,d,e,f;
	while(cin >> a >> b >> c >> d >> e >> f >> x >> y) {
    s=ka(a,b,c,d)+ka(c,d,e,f)+ka(a,b,e,f);
	if (360-t<s && 360+t>s) cout << "YES" << endl; else cout << "NO" << endl;
	}
	return 0;
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

#define REP(i,s,e) for(int i=int(s);i<int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-6

using namespace std;

bool intriangle(double x1,double y1,double x2,double y2,double x3,double y3,double xp,double yp){

double a=y2-y1;
double b=x1-x2;
double c=y1*(x2-x1)-x1*(y2-y1);

if((a*xp+b*yp+c)*(a*(x1+x2+x3)+b*(y1+y2+y3)+3*c)>0)
return true;
else
return false;
}

int main(){

double x1,y1,x2,y2,x3,y3,xp,yp;

while(true){

cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;

if(cin.fail()) break;

if(intriangle(x1,y1,x2,y2,x3,y3,xp,yp) && intriangle(x2,y2,x3,y3,x1,y1,xp,yp) && intriangle(x3,y3,x1,y1,x2,y2,xp,yp))
cout << "YES" << endl;
else cout << "NO" << endl;

}

	return 0;
}

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

typedef struct{

  double x,y;
}vec_t;

int main(){

  double x1,y1,x2,y2,x3,y3,xp,yp;
  vec_t AB,BC,CA,AP,BP,CP;

  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){

    AB.x=x2-x1 , AB.y=y2-y1;
    BC.x=x3-x2 , BC.y=y3-y2;
    CA.x=x1-x3 , CA.y=y1-y3;
    AP.x=xp-x1 , AP.y=yp-y1;
    BP.x=xp-x2 , BP.y=yp-y2;
    CP.x=xp-x3 , CP.y=yp-y3;

    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))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }

  return 0;
}