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>

int main(void) {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
    double s, t, u;
    x1 -= xp, x2 -= xp, x3 -= xp;
    y1 -= yp, y2 -= yp, y3 -= yp;
    printf("%f %f %f %f %f %f\n", x1, y1, x2, y2, x3, y3);
    s = x1 * y2 - x2 * y1;
    if(!s) {
      printf("NO\n");
      continue;
    }
    s = s < 0 ? 0 : 1;
    t = x2 * y3 - x3 * y2;
    if(!t) {
      printf("NO\n");
      continue;
    }
    t = t < 0 ? 0 : 1;
    u = x3 * y1 - x1 * y3;
    if(!u) {
      printf("NO\n");
      continue;
    }
    u = u < 0 ? 0 : 1;
    //printf("%d %d %d\n", s, t, u);
    if(s == t && t == u) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

C++: /*problem C*/

#include<stdio.h>

typedef struct{
	double x,y;
}point_obj;

int isClossLine(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
	return ( (x1-x2)*(y3-y1)+(y1-y2)*(x1-x3))*((x1-x2)*(y4-y1)+(y1-y2)*(x1-x4));
}

int main(){
	point_obj p[5];
	int i,j;
	p[3].x=0;
	p[3].y=0;

	while(cin>>p[0].x){
		cin>>p[0].y;

		p[3].x=p[0].x;
		p[3].y=p[0].y;

		for(int i=0;i<3;i++){
			cin>>p[i].x,cin>>p[i].y;

		p[3].x+=p[i].x;
		p[3].y+=p[i].y;
		}
			p[3].x+=p[0].x;
			p[3].y+=p[0].y;
	
			p[3].x/=3.0;
			p[3].y/=3.0;

			if(isClossLine(p[0].x,p[0].y,p[1].x,p[1].y,p[3].x,p[3].y,p[4].x,p[4].y) > 0 &&
				isClossLine(p[1].x,p[1].y,p[2].x,p[2].y,p[3].x,p[3].y,p[4].x,p[4].y) >0 &&
				isClossLine(p[0].x,p[0].y,p[2].x,p[2].y,p[3].x,p[3].y,p[4].x,p[4].y) > 0){

				printf("YES");
			}

			else{
				printf("NO");
			}
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

bool ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>0;
}

int main()
{
	for(string s;getline(cin,s);){
		istringstream iss(s);
		vector<double> x(3),y(3);
		rep(i,3)
			iss>>x[i]>>y[i];
		double xp,yp;
		iss>>xp>>yp;
		
		bool in_triangle=true;
		rep(i,3)
			if(ccw(x[0],y[0],x[1],y[1],xp,yp)!=ccw(x[1],y[1],x[2],y[2],xp,yp))
				in_triangle=false;
		
		cout<<(in_triangle?"YES":"NO")<<endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(void) {
  double x1, y1, x2, y2, x3, y3, xp, yp;
  while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
    int s, t, u;
    x1 -= xp, x2 -= xp, x3 -= xp;
    y1 -= yp, y2 -= yp, y3 -= yp;
    //printf("%f %f %f %f %f %f\n", x1, y1, x2, y2, x3, y3);
    s = x1 * y2 - x2 * y1;
    if(!s) {
      printf("NO\n");
      continue;
    }
    s = s < 0 ? 0 : 1;
    t = x2 * y3 - x3 * y2;
    if(!t) {
      printf("NO\n");
      continue;
    }
    t = t < 0 ? 0 : 1;
    u = x3 * y1 - x1 * y3;
    if(!u) {
      printf("NO\n");
      continue;
    }
    u = u < 0 ? 0 : 1;
    //printf("%d %d %d\n", s, t, u);
    if(!s^t && !t^u) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

C++: #include <stdio.h>
#include <math.h>

using namespace std;

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

	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		calc1 = (x2-x1)*(yp-y2)-(y2-y1)*(xp-x2);
		calc2 = (x3-x2)*(yp-y3)-(y3-y2)*(xp-x3);
		calc3 = (x3-x1)*(yp-y1)-(y3-y1)*(xp-x1);

		if((calc1>0&&calc2>0&&calc3>0) || (calc1<0&&calc2<0&&calc3<0)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
    return 0;
}

C++: #include <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;
double x[4],y[4];
string ok;

double cross_product(xy_t a,xy_t b) {
  return (conj(a)*b).imag()/2.0;
}

int main () {
  while (true) {
    for (int i=0; i<4; ++i) {
      cin >> x[i] >> y[i];
    }
    if (!cin) break;
    xy_t a(x[0],y[0]), b(x[1],y[1]), c(x[2],y[2]),p(x[3], y[3]);
    double pab = cross_product(a-p,b-p);
    double pbc = cross_product(b-p,c-p);
    double pca = cross_product(c-p,a-p);
    if ((pab>0&&pbc>0&&pca>0)||(pab<0&&pbc<0&&pca<0)) {
      ok = "YES";
    }
    else {
      ok = "NO";
    }
    cout << ok << endl;
  }
}

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cctype>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<algorithm>
using namespace std;

#define LL long long
#define LLU unsigned long long
#define re return(0)
#define pi 2*acos(0.0)
#define MAX 120

const int infinity=100000000000LL;

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

int main()
{
    double p1,p2,q1,q2,r1,r2,x1,x2;
    while(cin>>p1>>p2>>q1>>q2>>r1>>r2>>x1>>x2)
    {
        double a,b,c,s,area,new_area,m,n,o;
        new_area=0;
        a=Edge(p1,p2,q1,q2);
        b=Edge(q1,q2,r1,r2);
        c=Edge(r1,r2,p1,p2);
        s=(a+b+c)/2;
        area=s*(s-a)*(s-b)*(s-c);
        area=sqrt(area);
        m=Edge(x1,x2,p1,p2);
        n=Edge(x1,x2,q1,q2);
        o=Edge(x1,x2,r1,r2);
        s=(a+m+n)/2;
        new_area+=sqrt(s*(s-a)*(s-m)*(s-n));
        s=(b+n+o)/2;
        new_area+=sqrt(s*(s-b)*(s-o)*(s-n));
        s=(c+o+m)/2;
        new_area+=sqrt(s*(s-c)*(s-m)*(s-o));
        if(area==new_area) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    re;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

struct point {
	double x, y;
}A, B, C, P;

double crossProd(point A, point B, point C) {
	return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}

int main() {
	while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &P.x, &P.y) != EOF) {
		if (crossProd(A, B, P) > 0 && crossProd(B, C, P) > 0 && crossProd(C, A, P) > 0   //点在三角形内 
		 || crossProd(A, P, B) > 0 && crossProd(B, P, C) > 0 && crossProd(C, P, A) > 0) puts("YES");
		else puts("NO"); //点在三角形外 
	}
	return 0;
}