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<complex>
using namespace std;

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

int main(){
	complex<double> Points[3], P;
	while(true){
		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>
using namespace std;
double x[4],y[4],px,py,ax,ay,bx,by;
int main()
{
	while(true)
	{
		for(int i = 1;i<=3;i++){cin >> x[i];cin >> y[i];}
		if(cin.eof()){break;}
		cin >> px;
		cin >> py;
		double m,n;
		ax = x[2]-x[1];
		ay = y[2]-y[1];
		bx = x[3]-x[1];
		by = y[3]-y[1];
		px = px - x[1];
		py = py - y[1];
		double det = ax*by-ay*bx;
		m = (by*px-bx*py)/det;
		n = (-ay*px+ax*py)/det;
		if( det ==0) cout << "NO"<<endl;
		if(m>0 && m <= 1 && n > 0 && n <= 1 && m+n <= 1 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
	float x[3], y[3], xp, yp;
	float sM, s1, s2, s3;
	
	while (scanf("%f %f %f %f %f %f %f %f", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF){
		
		sM = ((x[1] - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (y[1] - y[0])) / 2;
		if (sM < 0){
			sM *= -1;
		}
		
		s1 = ((xp - x[2]) * (y[1] - y[2]) - (x[1] - x[2]) * (yp - y[2])) / 2;
		if (s1 < 0){
			s1 *= -1;
		}
		
		s2 = ((xp - x[1]) * (y[0] - y[1]) - (x[0] - x[1]) * (yp - y[1])) / 2;
		if (s2 < 0){
			s2 *= -1;
		}
		
		s3 = ((xp - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (yp - y[0])) / 2;
		if (s3 < 0){
			s3 *= -1;
		}
		
		if (sM == s1 + s2 + s3){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

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

int main(){
double x1;
double y1;
double x2;
double y2;
double x3;
double y3;
double xp;
double yp;
while(cin >> x1){
cin >> y1;
cin >> x2;
cin >> y2;
cin >> x3;
cin >> y3;
cin >> xp;
cin >> yp;
double x4;
double x5;
double x6;
double x7;
double x8;
int a;
a=0;

x4=(y2-y1)*(x3-xp)-(y3-yp)*(x2-x1);
x7=y2*x1-x2*y1;
x8=y3*xp-x3*yp;
x5=x7*(x3-xp)-x8*(x2-x1);
x6=x5/x4;

if((x2-x6)*(x6-x1)>0){a=a+1;}
if((x3-xp)*(xp-x6)>0){a=a+1;}
if(a==2){cout <<"YES"<<endl;}
if(a!=2){cout <<"NO"<<endl;}

}

}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	double a[2],b[2],c[2],p[2];
	double matrix[2][2],ans[2],reverse[2][2],det,x,y;
	while(cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>p[0]>>p[1]){
		b[0] = b[0]-a[0];
		b[1] = b[1]-a[1];
		c[0] = c[0]-a[0];
		c[1] = c[1]-a[1];
		p[0] = p[0]-a[0];
		p[1] = p[1]-a[1];
		matrix[0][0] = b[0];
		matrix[1][0] = c[0];
		matrix[0][1] = b[1];
		matrix[1][1] = c[1];
		ans[0] = p[0];
		ans[1] = p[1];
		det = matrix[0][0]*matrix[1][1]-matrix[0][1]*matrix[1][0];
		reverse[0][0] = matrix[1][1]/det;
		reverse[1][0] = -matrix[1][0]/det;
		reverse[0][1] = -matrix[0][1]/det;
		reverse[1][1] = matrix[0][0]/det;
		x = ans[0]*reverse[0][0]+ans[1]*reverse[1][0];
		y = ans[0]*reverse[0][1]+ans[1]*reverse[1][1];
		if(x>0 && y>0 && x+y<1){cout <<"YES"<<endl;}
		else{cout <<"NO"<<endl;}
	}
	return 0;
}

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

double x[4], y[4];

double l(int a, int b)
{
	return sqrt((y[a] - y[b]) * (y[a] - y[b]) + (x[a] - x[b]) * (x[a] - x[b]));
}

double T(int a, int b, int c)
{
	double A = l(a, b);
	double B = l(b, c);
	double C = l(c, a);
	double s = (A + B + C) / 2;
	return sqrt(s * (s - A) * (s - B) * (s - C));
}

int main()
{
	while (true){
		for (int i = 0; i < 4; i++){
			if (scanf("%lf %lf", &x[i], &y[i]) == EOF) return 0;
		}
		
		double S = T(0, 1, 3) + T(1, 2, 3) + T(2, 0, 3) - T(0, 1, 2);
		//printf("%.50lf\n", (double)S);
		if (S > (double)0.0){
			puts("NO");
		}
		else {
			puts("YES");
		}
	}
	
	return 0;
}