Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func check(x, y, x1, y1, x2, y2 float64) float64 {
	return (x2-x1)*y - (y2-y1)*x + x1*y2 - x2*y1
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]float64, 8)
	for scanner.Scan() {
		info := strings.Split(scanner.Text(), ",")
		for j := 0; j < 8; j++ {
			a[j], _ = strconv.ParseFloat(info[j], 64)
		}
		if check(a[0], a[1], a[2],a[3], a[6], a[7])*check(a[4], a[5], a[2], a[3], a[6], a[7]) < 0 && check(a[6], a[7], a[0], a[1], a[4], a[5])*check(a[2],a[3], a[0], a[1], a[4], a[5]) < 0 {
			fmt.Println("YES")	
		} else {
			fmt.Println("NO")
		}
	}
}

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

using namespace std;

int main(){
	double x[4];
	double y[4];
	char c;

	while(cin >> x[0] >> c >> y[0]){
		for(int i=1;i<4;i++){
			cin >> c >> x[i] >> c >> y[i];
		}
		bool flag1 = 0;
		bool flag2 = 0;
		
		for(int i=0;i<4;i++){
			if((x[(i+2)%4]-x[i%4])*(y[(i+1)%4]-y[i%4])-(y[(i+2)%4]-y[i%4])*(x[(i+1)%4]-x[i%4])>0){
				flag1=1;
			}
			else{
				flag2=1;
			}
		}

		if(flag1 && flag2){
			cout << "NO" << endl;
		}
		else if(flag1 || flag2){
			cout << "YES" <<endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

using namespace std;

double CalcurateTheta(double, double, double, double, double, double);
double CalcurateLength(double, double, double, double);
int CheckRadian(double);

int main(){
  double xa, ya, xb, yb, xc, yc, xd, yd;
  double a, b, c, d, w, x, y, z; 
  char c1, c2, c3, c4, c5, c6, c7;

  while(cin >> xa >> c1 >> ya >> c2 >> xb >> c3 >> yb >> c4 >> xc >> c5 >> yc >> c6 >> xd >> c7 >> yd){
    a = CalcurateTheta(xa, ya, xb, yb, xd, yd);
    b = CalcurateTheta(xb, yb, xc, yc, xa, ya);
    c = CalcurateTheta(xc, yc, xd, yd, xb, yb);
    d = CalcurateTheta(xd, yd, xa, ya, xc, yc);

    w = CheckRadian(a+b+d);
    x = CheckRadian(b+c+a);
    y = CheckRadian(c+d+b);
    z = CheckRadian(d+a+c);

    if(w == 1 && x == 1 && y == 1 && z == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

double CalcurateTheta(double xa, double ya, double xb, double yb, double xc, double yc){
  double a, b, c, cos_theta, theta;

  a = CalcurateLength(xa, ya, xb, yb);
  b = CalcurateLength(xc, yc, xa, ya);
  c = CalcurateLength(xb, yb, xc, yc);

  cos_theta = (a*a + b*b - c*c)/(2*a*b);
  theta = acos(cos_theta);

  return theta;
}

double CalcurateLength(double x1, double y1, double x2, double y2){
  double a, b, c;

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

  return c;
}

int CheckRadian(double radian){
  if(radian > M_PI)
    return 1;
  else
    return 0;
}

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

using namespace std;
double x[4], y[4];
double ab, bc, cd, da, ac, bd;

double len(double x1, double y1, double x2, double y2)
{
    return sqrt(pow(x1-x2, 2.0) + pow(y1-y2, 2.0));
}

// Heron's Formula
double square(double a, double b, double c)
{
    double s = (a + b + c) / 2.0;
    return sqrt(s * (s-a) * (s-b) * (s-c));
}


int main(void)
{
    while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",x,y,x+1,y+1,x+2,y+2,x+3,y+3)) {
        ab = len(x[0],y[0],x[1],y[1]);
        bc = len(x[1],y[1],x[2],y[2]);
        cd = len(x[2],y[2],x[3],y[3]);
        da = len(x[3],y[3],x[1],y[1]);
        ac = len(x[0],y[0],x[2],y[2]);
        bd = len(x[3],y[3],x[1],y[1]);
        double s1,s2,s3,s4;
        s1 = square(ab, bd, da);
        s2 = square(cd, bd, bc);
        s3 = square(ac, cd, da);
        s4 = square(ab, bc, ac);
        double comp1;
        comp1 = (s1+s2) - (s3+s4);

        if(fabs(comp1) <= 0.01)
            puts("YES");
        else
            puts("NO");
    }
    return 0;
}

C++: #include<iostream>
#include<complex>
#include<cstdio>
using namespace std;
bool crossfl(complex<double> v, complex<double> a, complex<double> b);
double outv(complex<double> a, complex<double> b);
int main(){
  complex<double> a,b,c,d;
  for(;;){
    if(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&(a.real()),&(a.imag()),&(b.real()),&(b.imag()),&(c.real()),&(c.imag()),&(d.real()),&(d.imag())) == EOF) break;
    if((crossfl(c-a,b-a,d-a)) && crossfl(d-b,a-b,c-b)) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
}
bool crossfl(complex<double> v, complex<double> a, complex<double> b){
  return ((outv(v,a)*outv(v,b))<0);
}
double outv(complex<double> a, complex<double> b){
  return a.real()*b.imag()-a.imag()*b.real();
}

C++: #include <iostream>
#include <cmath>
#include <vector>

using namespace std;

float calc_crossProduct(float x1, float y1, float x2, float y2){
  return (x1*y2-y1*x2);
}

int main(){
  int cnt = 0;
  while(true){
    string strall;
    cin >> strall;
    
    vector<float> x(4, 0.0);
    vector<float> y(4, 0.0);
    char c;
    for(int i=0;i<4;i++){
      int pos = strall.find(",");
      //      cout << pos << endl;
      //      cout << strall.substr(0, pos) << endl;
      x[i] = std::stof(strall.substr(0, pos));
      
      strall.erase(strall.begin(), strall.begin() +  pos + 1);
      //      cout << strall << endl;
      
      //      cout << strall.substr(0, pos) << endl; 
      y[i] = std::stof(strall.substr(0, pos));
      strall.erase(strall.begin(), strall.begin() + pos + 1);
    }

    if(cnt < 2){
      for(int i=0;i<4;i++){
	//	cout << "(" << x[i] << ", " << y[i] << ")" << endl;
      }
      cnt++;
    }


    bool flag = true;
    vector<float> cp(4, 0.0);    
    for(int i=0;i<4;i++){
     
      float x1 = x[i];float y1 = y[i];
      float x2 = x[(i+1)%4];float y2 = y[(i+1)%4];
      float x3 = x[(i+2)%4];float y3 = y[(i+2)%4];

      float x2x1 = x2-x1; float y2y1 = y2-y1;
      float x3x1 = x3-x1; float y3y1 = y3-y1;

      cp[i] = calc_crossProduct(x2x1, y2y1, x3x1, y3y1);
      if(cp[i] < 0){
	flag = false;
	break;
      }
    }

    if(flag != false){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }  
}

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

typedef complex<double> P;

#define x real()
#define y imag()

double isIntersect(P p1, P p2,P p3,P p4 ){
  return (((p1.x - p2.x)*(p3.y - p1.y)+(p1.y-p2.y)*(p1.x-p3.x))*((p1.x - p2.x)*(p4.y - p1.y)+(p1.y-p2.y)*(p1.x-p4.x)));
}

int main(){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  char e;
  while( scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd) != EOF ){

    P a(xa , ya);
    P b(xb , yb);
    P c(xc , yc);
    P d(xd , yd);

    if(isIntersect(a,c,b,d) > 0 || isIntersect(b,d,a,c) > 0){
      cout << "NO" <<endl;
    }else cout << "YES" << endl; 


}
  return 0;
}

C++: #include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;


int main() {
	double x1, x2, x3, x4, y1, y2, y3, y4, dist1, dist2, dist3, dist4, dist5, dist6;

	while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != EOF) {
		dist1 = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
		dist2 = sqrt((x2 - x4) * (x2 - x4) + (y2 - y4) * (y2 - y4));
		dist3 = fabs((y2 - y4) * x1 + (x4 - x2) * y1 + y2 * (x2 - x4) - x2 * (y2 - y4)) / (sqrt((y2 - y4) * (y2 - y4) + (x4 - x2) * (x4 - x2)));
		dist4 = fabs((y1 - y3) * x2 + (x3 - x1) * y2 + y1 * (x1 - x3) - x1 * (y1 - y3)) / (sqrt((y1 - y3) * (y1 - y3) + (x3 - x1) * (x3 - x1)));
		dist5 = fabs((y2 - y4) * x3 + (x4 - x2) * y3 + y2 * (x2 - x4) - x2 * (y2 - y4)) / (sqrt((y2 - y4) * (y2 - y4) + (x4 - x2) * (x4 - x2)));
		dist6 = fabs((y1 - y3) * x4 + (x3 - x1) * y4 + y1 * (x1 - x3) - x1 * (y1 - y3)) / (sqrt((y1 - y3) * (y1 - y3) + (x3 - x1) * (x3 - x1)));

		if (dist1 < dist3 || dist2 < dist4 || dist1 < dist5 || dist2 < dist6) {
			printf("NO\n");
		}
		else {
			printf("YES\n");
		}
	}

	return 0;
}