Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

int dis(float x1, float y1, float x2, float y2)
{
	return (sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
}

int min(int i, int j)
{
	if (i < j){
		return (i);
	}
	
	return (j);
}

int main(void)
{
	int n;
	int ac, ad, bc, bd;
	float coord[2][4];
	int i, j;
	
	scanf("%d", &n);
	while (n){
		for (i = 0; i < 4; i++){
			for (j = 0; j < 2; j++){
				scanf("%f", &coord[j][i]);
			}
		}
		
		ac = dis(coord[0][0], coord[1][0], coord[0][2], coord[1][2]);
		bc = dis(coord[0][1], coord[1][1], coord[0][2], coord[1][2]);
		ad = dis(coord[0][0], coord[1][0], coord[0][3], coord[1][3]);
		bd = dis(coord[0][0], coord[1][0], coord[0][2], coord[1][2]);
		
		if (min(ac, ad) == min(bc, bd)){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

C++: #include <cstdio>

using namespace std;

double x1,y1,x2,y2,x3,y3,x4,y4;
    

int main()
{
    int n; scanf( "%d\n", &n );
    while( n > 0 )
    {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4 );
        double dx1 = x2 - x1, dx2 = x4 - x3, dy1 = y2 - y1, dy2 = y4 - y3, det = dx1 * dy2 - dx2 * dy1;

        if( det < 0.000000001 )
        {
            printf( "YES\n" );
        }
        else
        {
            printf( "NO\n" );
        }

        /* if( (dx1 == 0 && dx2 == 0) || (dy1 == 0 && dy2 == 0 ) )
        {
            printf( "YES\n" );
        }
        else if( dx1 != 0 && dx2 != 0 )
        {
            dy1 /= dx1;
            dy2 /= dx2;
            if( dy1 == dy2 || dy1 == -dy2 )
            {
                printf( "YES\n" );
            }
        }
        else
        {
            printf( "NO\n" );
        }
         */
        n--;
    }
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
  int n,i;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int ans[100];
  
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
  
    if( (x2-x1)*(y4-y3)-(x4-x3)*(y2-y1) == 0){
      ans[i] = 1;
    }else{
      ans[i] = 0;
    }
  }

  for(i = 0;i < n;i++){
    if(ans[i] == 1){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
	freopen("testcase.pl", "r", stdin);
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	int i,j;
	for (i = 0; i < n; ++i){
		vector <double> px (4, 0.0);
		vector <double> py (4, 0.0);
		getline (cin, str );
		stringstream ss(str);
		for (j = 0; j < 4; ++j){
			ss >> px[j] >> py[j];
		} // end for
		multimap <double, double> v;

		for (j = 0; j < 2; ++j){
			v.insert (make_pair (px[2*j + 1] - px[2*j], py[2*j + 1] - py[2*j] ) );
		} // end for

		multimap <double, double>::iterator it = v.begin();
		double xp = (*it).first;
		double yp = (*it).second;
		++it;		
		double xa = (*it).first;
		double ya = (*it).second;
		bool found = false;

		if (xp != 0. && yp != 0.){
			if ( fabs( (*it).first/xp - (*it).second/yp ) < 1e-6 ){
				found = true;
			}else{
				found = false;
			} // end if
		}else{	// if (xp == 0. || yp == 0. )
			if (yp != 0. ){ // xp == 0. && yp != 0.
				if (xa == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else if (xp != 0.){ // xp != 0. && yp == 0.
				if (ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else{ // if (xp == 0. && yp == 0.)
				if (xa == 0. &&  ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			} // end if
		} // end if

		if (found ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if

	} // end for
		
	return 0;
}

C++: /*****include*****/
#include <iostream>
#include <fstream>
#include <string>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	int n;
	double x[4];
	double y[4];
	double slope_AB;
	double slope_CD;
	/*****処理部*****/
	cin >> n;
	for(int loop=0;loop<n;loop++){
		for(int i=0;i<4;i++){
			cin >> x[i];
			cin >> y[i];
		}
		slope_AB = (y[0] - y[1])/(x[0] - x[1]);
		slope_CD = (y[2] - y[3])/(x[2] - x[3]);
		if(slope_AB == slope_CD)	cout << "YES" << endl;
		else						cout << "NO" << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_ *1000000 + 0.5;
                y[i][j] = y_ *1000000 + 0.5;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}