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++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>

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 P {
	double x, y;

	P() {}
	P(double x, double y) : x(x), y(y) {
	}
	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d) {
		return P(x * d, y * d);
	}
	double dot(P p) {	//　内積
		return add(x * p.x, y * p.y);
	}
	double det(P p) {	//　外積
		return add(x * p.y, -y * p.x);
	}
};

//　線分p1-p2上に点qがあるか判定
bool on_seg(P p1, P p2, P q) {
		return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}

//　直線p1-p2と直線q1-q2の交点
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}


int main() {

	P a, b, c, d;
	char dummy;

	while ( cin >> a.x >> dummy >> a.y >> dummy >> b.x >> dummy >> dummy >> b.y >> dummy >> c.x >> dummy >> c.y >> dummy >> d.x >> dummy >> d.y ) {
		int count_a = 0, count_b = 0, count = 4;

		if( (b - a).det(c - b) < 0 ) {
			count_a--;
		} else if( (b - a).det(c - b) > 0 ) {
			count_b++;
		} else if( (b - a).det(c - b) == 0 ) {
			count--;
		}

		if( (c - b).det(d - c) < 0 ) {
			count_a--;
		} else if( (c - b).det(d - c) > 0 ) {
			count_b++;
		} else if( (c - b).det(d - c) == 0 ) {
			count--;
		}

		if( (d - c).det(a - d) < 0 ) {
			count_a--;
		} else if( (d - c).det(a - d) > 0 ) {
			count_b++;
		} else if( (d - c).det(a - d) == 0 ) {
			count--;
		}

		if( (a - d).det(b - a) < 0 ) {
			count_a--;
		} else if( (a - d).det(b - a) > 0 ) {
			count_b++;
		} else if( (a - d).det(b - a) == 0 ) {
			count--;
		}

		if( abs(count_a) == count || abs(count_b) == count ) {
			cout << "YES" << endl;
 		} else {
			cout << "NO" << endl;
		}
	}
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<cstring>
using namespace std;
#define F first
#define S second
typedef pair<double,double> P;
P A[4];
bool check(int pre,int now,int nex){//前、今、次
  if(pre==0) return true;
  double a = atan2((A[pre].S-A[now].S),(A[pre].F-A[now].F));
  double b = atan2((A[nex].S-A[now].S),(A[nex].F-A[now].F));
  if(max(a,b)-min(a,b)>=M_PI/2.0 && max(a,b)-min(a,b)<=(M_PI/2.0)*3) return true;
  return false;
}

int main(){
  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",
	      &A[0].F,&A[0].S,
	      &A[1].F,&A[1].S,
	      &A[2].F,&A[2].S,
	      &A[3].F,&A[3].S)!=EOF){
    
    bool f=true;
    for(int i=0;i<4;i++){
      int pre = (i+3)%4;
      int now = i;
      int next = (i+1)%4;
      if(!check(pre,now,next)) f=false;
    }
    if(f) puts("YES");
    else puts("NO");
  }
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Point{
public:
    double y, x;
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    Point(){
        y = x = 0.0;
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x;
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
};

int main()
{
    for(;;){
        vector<Point> p(4);
        for(int i=0; i<4; ++i){
            char c;
            if(!(cin >> p[i].x >> c >> p[i].y))
                return 0;
            if(i < 3)
                cin >> c;
        }

        bool plus = true;
        bool minus = true;
        for(int i=0; i<4; ++i){
            Point p1 = p[(i+2)%3] - p[(i+1)%3];
            Point p2 = p[i] - p[(i+1)%3];
            if(p1.cross(p2) < 0)
                plus = false;
            else
                minus = false;
        }
        if(plus || minus)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

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

int main(){
	char trash;
	double x[4], y[4];
	while(cin >> x[0] >> trash >> y[0]){
		double a,b,c,d,e,f,t,r;
		for(int i = 1; i < 4; i++){
			cin >> trash >> x[i] >> trash >> y[i];
		}
		a = y[2]-y[0];
		b = -x[2]+x[0];
		e = -1*(y[0]*(x[2]-x[0])-x[0]*(y[2]-y[0]));
		c = y[3]-y[1];
		d = -x[3]+x[1];
		f = -1*(y[1]*(x[3]-x[1])-x[1]*(y[3]-y[1]));
		t = (e*d-b*f)/(a*d-b*c);
		r = (a*f-c*e)/(a*d-b*c);
		if(x[2] < x[0]){
			swap(x[0],x[2]);
		}
		if(x[3] < x[1]){
			swap(x[1],x[3]);
		}
		if(y[2] < y[0]){
			swap(y[0],y[2]);
		}
		if(y[3] < y[1]){
			swap(y[1],y[3]);
		}
		if((t >= x[0] && t <= x[2]) && (t >= x[1] && t <= x[3]) && (r >= y[0] && r <= y[2]) && (r >= y[1] && r <= y[3])){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <cstdio>

using namespace std;

struct p{
	double x;
	double y;

	p operator -(p& rh){
		p pnt;
		pnt.x = this->x - rh.x;
		pnt.y = this->y - rh.y;
		return pnt;
	}

	void print(){
		cout << this->x << ", " << this->y << endl;
	}
};

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

bool isLeft(p a, p b, p c){	// c が ab より左ならtrue
	//a.print();
	//b.print();
	//c.print();
	//cout << "cross:" << cross(b-a, c-a) << endl << endl;
	return (cross(b-a, c-a) > 0);
}

bool isInside(p a, p b, p c, p d){ // d が abc 内部なら true
	bool left = false;
	bool right = false;

	bool m, n, l;
	m = isLeft(a, b, d);
	n = isLeft(b, c, d);
	l = isLeft(c, a, d);
	left = m || n || l;
	right = !m || !n || !l;
	
	return left^right;
}

int main(){

	p pnt[4];

	while(scanf("%lf", &pnt[0].x) != EOF){
		scanf(",%lf", &pnt[0].y);
		for(int i = 1; i < 4; i++){
			scanf(",%lf", &pnt[i].x);
			scanf(",%lf", &pnt[i].y);
		}

		bool b = true;

		for(int i = 0; i < 4 && b; i++){
			b &= !isInside(pnt[(i+0)%4], pnt[(i+1)%4], pnt[(i+2)%4], pnt[(i+3)%4]);
		}

		if(b){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <complex>
#define EPS 1e-10
#define EQ(a, b) (abs((a) - (b)) < EPS)
using namespace std;
typedef complex<double> P;

double cross(P a, P b) {
    return(a.real() * b.imag() - a.imag() * b.real());
}
int is_intersect(P a1, P a2, P b1, P b2) {
    return(cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS) &&
    (cross(b2-a1, a1-b1) * cross(b2-b1, a2-b1) < EPS);
}

int main(void) {
    double xa, ya, xb, yb, xc, yc, xd, yd;
    while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd) != EOF) {
        P a(xa, ya), b(xb, yb), c(xc, yc), d(xd, yd);
        if(is_intersect(a, c, b, d) && is_intersect(b, d, a, c)) cout << "YES" << endl;
        else                                                 cout << "NO"  << endl;
    }
    return(0);
}