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 <bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a),end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

double triangleArea(double x, double y, double z){
    return (y * z * sin( acos( (y * y +  z * z - x * x) / (2 * y * z) ) )) / 2;
}

double inputXY(double x1, double y1, double x2, double y2, double x3, double y3){
    double x, y ,z;
    x = dist(x1, y1, x2, y2);
    y = dist(x2, y2, x3, y3);
    z = dist(x3, y3, x1, y1);
    return triangleArea(x, y, z);
}

int main(){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double allArea, area12, area23, area31;
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
        allArea = inputXY(x1, y1, x2, y2, x3, y3);
        area12 = inputXY(xp, yp, x2, y2, x1, y1);
        area23 = inputXY(x2, y2, x3, y3, xp, yp);
        area31 = inputXY(x3, y3, x1, y1, xp, yp);

        if(abs(allArea - (area12 + area23 + area31)) < 0.000001) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include <iostream>

using namespace std;

typedef struct _Point {
	double x;
	double y;
} Point;

typedef struct _Line {
	Point a;
	Point b;
} Line;

typedef struct _Triangle {
	Point a;
	Point b;
	Point c;
} Triangle;

double interSect(Point p1, Point p2, Point p3, Point p4) {
	double ret = 0, ret_ = 0;
	ret += (p1.x - p2.x) * (p3.y - p1.y);
	ret += (p1.y - p2.y) * (p1.x - p3.x);
	ret_ += (p1.x - p2.x) * (p4.y - p1.y);
	ret_ += (p1.y - p2.y) * (p1.x - p4.x);
	ret *= ret_;
	return ret;
}

bool pointInaTriangle(Point p, Triangle t) {
	if ((t.a.x - t.c.x) * (t.a.y - t.b.y) == (t.a.x - t.b.x) * (t.a.y - t.c.y))
		return false;
	Point c;
	c.x = (t.a.x + t.b.x + t.c.x) / 3;
	c.y = (t.a.y + t.b.y + t.c.y) / 3;
	double pab = interSect(t.a, t.b, p, c);
	double pbc = interSect(t.b, t.c, p, c);
	double pca = interSect(t.c, t.a, p, c);
	if (pab < 0 && pbc < 0 && pca < 0)
		return true;
	return false;
}

int main() {
	Triangle t;
	Point p;
	while (cin >> t.a.x >> t.a.y >> t.b.x >> t.b.y >> t.c.x >> t.c.y >> p.x >> p.y) {
		if (pointInaTriangle(p, t) == true)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 while(ir.hasNext()){
  P[] ps=new P[3];
  for(int i=0;i<3;i++) ps[i]=new P(ir.nextDouble(),ir.nextDouble());
  P p=new P(ir.nextDouble(),ir.nextDouble());
  double tot=0;
  for(int i=0;i<3;i++){
   tot+=Math.abs(ps[i].sub(p).det(ps[(i+1)%3].sub(p)));
  }
  if(accurateTotal(-tot,Math.abs(ps[1].sub(ps[0]).det(ps[2].sub(ps[0]))))==0.0) out.println("YES");
  else out.println("NO");
 }
}

static final double EPS=1e-10;

public static double accurateTotal(double a,double b){
 if(Math.abs(a+b)<EPS*(Math.abs(a)+Math.abs(b))) return 0.0;
 return a+b;
}

static class P{

 public double x,y;

 public P(double x,double y){
  this.x=x; this.y=y;
 }

 public double getX(){
  return this.x;
 }

 public double getY(){
  return this.y;
 }

 public P add(P v){
  return new P(accurateTotal(this.x,v.x),accurateTotal(this.y,v.y));
 }

 public P sub(P v){
  return new P(accurateTotal(this.x,-v.x),accurateTotal(this.y,-v.y));
 }

 public P mul(double k){
  return new P(this.x*k,this.y*k);
 }

 public double dot(P v){
  return accurateTotal(this.x*v.x,this.y*v.y);
 }

 public double det(P v){
  return accurateTotal(this.x*v.y,-this.y*v.x);
 }
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {

 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

C++: #include<cstdio>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

#define ll long long
#define LL long long
#define ULL unsigned long long 
#define ull unsigned long long 
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define int(x) int x;scanf("%d",&x);
#define double(x) double x;scanf("%lf",&x);
#define string(x) double string;cin>>x;

using namespace std;

int main()
{
	float x1, x2, x3, y1, y2, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp)
	{

		float x_max, x_min, y_max, y_min;
		x_max = max(x1, max(x2, x3));
		x_min = min(x1, min(x2, x3));
		y_max = max(y1, max(y2, y3));
		y_min = min(y1, min(y2, y3));

		if (xp < x_max&&xp > x_min&&yp > y_min&&yp < y_max) {
			cout << "YES\n";
		}
		else {
			cout << "NO\n";
		}
	}

	return 0;
}