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 <stdio.h>

double cr(double x1, double y1, double x2, double y2) {
	return x1*y2-x2*y1;
}

int main()
{
	for(;;) {
		double x[4], y[4];
		if (scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
					x, y, x+1, y+1, x+2, y+2, x+3, y+3)==EOF) {
			return 0;
		}
		else {
			double cr1 = cr(x[3]-x[0], y[3]-y[0], x[3]-x[1], y[3]-y[1]);
			double cr2 = cr(x[3]-x[1], y[3]-y[1], x[3]-x[2], y[3]-y[2]);
			double cr3 = cr(x[3]-x[2], y[3]-y[2], x[3]-x[0], y[3]-y[0]);
			if (cr1*cr2>=0 && cr2*cr3>=0) printf("YES\n");
			else printf("NO\n");
		}
	}
}

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

double cross(complex<double> A, complex<double> B){
	return (conj(A)*B).imag();
}

int main(){
	while(true){
		complex<double> Points[3], P;
		double x,y;
		for(int i=0;i<3;i++){
			cin >> x >> y;
			Points[i]={x,y};
		}

		cin >> x >> y;
		P={x,y};

		if(!cin)break;

		int sum=0;
		for(int i=0;i<3;i++){
			sum += cross((Points[(i+1)%3]-Points[i]), (P-Points[i])) > 0;
		}
		cout << (sum==0||sum==3 ? "Yes":"No") << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stack>
#include <stdio.h>
using namespace std;
double a,b,c;//ax+by+c=0
double x[4],y[4];//p,1,2,3
void make_line(double x1,double y1,double x2,double y2){
	if(x1!=x2&&y1!=y2){
		a=(y1-y2)/(x1-x2);
		b=-1;
		c=-a*x1+y1;
	}else if(x1==x2){
		a=1;
		b=0;
		c=-x1;
	}else if(y1==y2){
		a=0;
		b=1;
		c=-y1;
	}
	return;
}
bool check(int p,int q,int r){
	make_line(x[p],y[p],x[q],y[q]);//line pq
	if((a*x[r]+b*y[r]+c)*(a*x[0]+b*y[0]+c)<=0)return false;
	return true;
}

int main()
{
	while(cin>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3]>>x[0]>>y[0]){
		bool ans=true;
		ans&=check(1,2,3);
		ans&=check(2,3,1);
		ans&=check(3,1,2);
		printf(ans?"YES\n":"NO\n");
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
double x[3],y[3],xp,yp;
int solve(){
	int tes=0,i,j;
	for(i=0,j=2;i<3;j=i++){
		if(((yp>y[i]&&yp<=y[j])||(yp<=y[i]&&yp>y[j]))&&xp<=(x[i]-x[j])*(yp-y[i])/(y[i]-y[j])+x[i])
			tes++;
	}
	
	return tes%2==1;
}
int main(){
	while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>xp>>yp){
		if(solve()==1)
			cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
bool pt(double px,double py,double qx,double qy,double rx,double ry,double sx,double sy){
  if(((qx-rx)*(px-qx)+(qy-ry)*(py-qy)<=0&&(rx-sx)*(px-rx)+(ry-sy)*(py-ry)<=0&&(sx-qx)*(px-sx)+(sy-qy)*(py-sy)<=0)||
     ((qx-rx)*(px-qx)+(qy-ry)*(py-qy)>=0&&(rx-sx)*(px-rx)+(ry-sy)*(py-ry)>=0&&(sx-qx)*(px-sx)+(sy-qy)*(py-sy)>=0))
    return 1;
  else
    return 0;
}
int main(){
  double px,py,qx,qy,rx,ry,sx,sy;
  while(cin>>qx>>qy>>rx>>ry>>sx>>sy>>px>>py){
    if(pt(px,py,qx,qy,rx,ry,sx,sy))
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>

using namespace std;

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 point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
  
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}

double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}

int is_point_on_line(point a, point b, point c) {
  return cross(b-a, c-a)==0.0 &&
         (dot(b-a, c-a) > -EPS) &&
         (dot(a-b, c-b) > -EPS);
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {

  if(cross(a1-a2,b1-b2)==0){
    return is_point_on_line(a1,a2,b1) || is_point_on_line(a1,a2,b2) 
        || is_point_on_line(b1,b2,a1) || is_point_on_line(b1,b2,a2);
  }
  else {
    return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
           ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
  }
}

int inside(point p, vector<point> ps){
  point a,b;
  a=b=p;

  b.x=DBL_MAX;

  int n=ps.size();
  ps.push_back(ps[0]);

  double ymx=-DBL_MAX,ymn=DBL_MAX;
  for(int i=0;i<n;i++){
    ymx=max(ymx,ps[i].y);
    ymn=min(ymn,ps[i].y);
  }
  if(a.y<=ymn||a.y>=ymx)return 0;
  
  for(int i=0;i<n;i++){
    if(is_point_on_line(ps[i],ps[i+1],p))return 1;
  }
  
  int cnt1=0;
  for(int i=0;i<n;i++)
    if(is_point_on_line(a,b,ps[i]))cnt1++;
  
  int cnt=0;
  for(int i=0;i<n;i++)
    if(is_intersected_ls(ps[i],ps[i+1],a,b))cnt++;
  
  return (cnt-cnt1/2)%2;
}

int main(void){
 
  point in[4],p;
  vector<point>ps;

  while(cin>>in[1].x>>in[1].y>>in[2].x>>in[2].y>>in[3].x>>in[3].y>>p.x>>p.y){

    for(int i=1;i<4;i++)
    ps.push_back(in[i]);

    if(inside(p,ps))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
 
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
double check(double xa,double ya,double xb,double yb,double xc,double yc);
int main(void){
    double qxa,qya,qxb,qyb,qxc,qyc,qxp,qyp;
    while(cin>>qxa){
 
        cin>>qya>>qxb>>qyb>>qxc>>qyc>>qxp>>qyp;
        double abc,abp,bcp,cap;
        abc=check(qxa,qya,qxb,qyb,qxc,qyc);
        abp=check(qxa,qya,qxb,qyb,qxp,qyp);
        bcp=check(qxb,qyb,qxc,qyc,qxp,qyp);
        cap=check(qxc,qyc,qxa,qya,qxp,qyp);
 
        double var=abc-(abp+bcp+cap);
        if(var<=0.01&&var>=-0.01)var=0.0;
        if(var==0.0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
 
 
    }
    return 0;
}
 
 
double check(double xa,double ya,double xb,double yb,double xc,double yc){
 
    double ab,bc,ca;
    double S,s;
    ab=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
    bc=sqrt((xb-xc)*(xb-xc)+(yb-yc)*(yb-yc));
    ca=sqrt((xc-xa)*(xc-xa)+(yc-ya)*(yc-ya));
    s=0.5*(ab+bc+ca);
    S=sqrt(s*(s-ab)*(s-bc)*(s-ca));
    //cout<<S<<endl;
    return S;
 
 
}

C++: #include <iostream>
#include <sstream>
#include <string>

/// check if (x1, y1) <-> (x2, y2) and (x3, y3) <-> (x4, y4) is crossed.
bool is_cross(double x1, double y1, double x2, double y2,
              double x3, double y3, double x4, double y4)
{
  if (((x1 - x2) * (y3 - y1) + (y1 - y2) * (x1 - x3)) *
      ((x1 - x2) * (y4 - y1) + (y1 - y2) * (x1 - x4)) > 0) {
    return false;
  } else {
    return true;
  }
}

int main()
{
  double x1, y1, x2, y2, x3, y3, xp, yp, center_x, center_y;
  while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    center_x = (x1 + x2 + x3) / 3.0;
    center_y = (y1 + y2 + y3) / 3.0;
    if (is_cross(x1, y1, x2, y2, xp, yp, center_x, center_y) ||
        is_cross(x1, y1, x3, y3, xp, yp, center_x, center_y) ||
        is_cross(x2, y2, x3, y3, xp, yp, center_x, center_y)) {
      std::cout << "NO" << std::endl;
    } else {
      std::cout << "YES" << std::endl;
    }
  }
  return 0;
}