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)
		}
		if fpoints[0] == fpoints[2] && fpoints[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		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++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

template<typename T>
class UF
{
public:
	UF ()
	{
		count = 0;
	}

	void push ( T a )
	{
		M[a] = count;
		V.push_back ( count );
		rank.push_back ( 0 );
		count++;
	}

	void unite ( T a , T b )
	{
		long long int x = find ( M[a] );
		long long int y = find ( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] )
		{
			V[x] = y;
		} else
		{
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge ( T a , T b )
	{
		unite ( a , b );
	}
	bool same ( T a , T b )
	{
		return find ( M[a] ) == find ( M[b] );
	}
	long long int group ()
	{
		set<long long int>S;
		for( long long int i = 0; i < V.size (); i++ )
		{
			S.insert ( find ( V[i] ) );
		}
		return S.size ();
	}

private:
	vector<long long int> V , rank;
	map < T , long long int>M;
	long long int count;

	long long int find ( long long int x )
	{
		if( V[x] == x )return x;
		else return V[x] = find ( V[x] );
	}
};

const long double EPS = 1e-10;
class D3
{
public:
	long double x;
	long double y;
	long double z;


	//?????????????????????
	D3 ( long double x_ = 0.0 , long double y_ = 0.0 , long double z_ = 0.0 )
	{
		x = x_;
		y = y_;
		z = z_;
	}

	//??????
	D3 Cross_product ( D3 partner )
	{
		D3 ret ( y*partner.z - z*partner.y , z*partner.x - x*partner.z , x*partner.y - y*partner.x );
		return ret;
	}

	//??????
	long double Inner_product ( D3 partner )
	{
		return x*partner.x + y*partner.y + z*partner.z;
	}

	//?????????????????????????????????
	D3 Make_vector ( D3 partner )
	{
		D3 ret ( partner.x - x , partner.y - y , partner.z - z );
		return ret;
	}

	//???????§????2????????????????????¢???????±???????
	long double S_vec ( D3 A , D3 B )
	{
		D3 G;
		G = A.Cross_product ( B );
		return sqrt ( G.Inner_product ( G ) ) / 2;
	}

	//??????????????¢???????±???????
	long double S_point ( D3 A , D3 B , D3 C )
	{
		return S_vec ( A.Make_vector ( B ) , A.Make_vector ( C ) );
	}

	//???????§????3????????????????????????????±???????
	long double V_vec ( D3 A , D3 B , D3 C )
	{
		D3 G;
		G = A.Cross_product ( B );
		return G.Inner_product ( C ) / 6;
	}

	//4???????????????????±???????
	long double V_point ( D3 A , D3 B , D3 C , D3 D )
	{
		return V_vec ( A.Make_vector ( B ) , A.Make_vector ( C ) , A.Make_vector ( D ) );
	}

	D3 operator+( D3 partner )
	{
		return D3 ( x + partner.x , y + partner.y , z + partner.z );
	}

	D3 operator-( D3 partner )
	{
		return D3 ( x - partner.x , y - partner.y , z - partner.z );
	}

	D3 operator*( D3 partner )
	{
		return D3 ( x * partner.x , y * partner.y , z * partner.z );
	}

	D3 operator/( D3 partner )
	{
		return D3 ( x / partner.x , y / partner.y , z / partner.z );
	}

	D3 operator*( double d )
	{
		return D3 ( x * d , y * d , z * d );
	}

	D3 operator/( double d )
	{
		return D3 ( x / d , y / d , z / d );
	}

	bool operator==( D3 partner )
	{
		return abs ( x - partner.x ) < EPS&&abs ( y - partner.y ) < EPS&&abs ( z - partner.z ) < EPS;
	}

	long double length ()
	{
		return sqrt ( x*x + y*y + z*z );
	}

	//???????????????????????????
	//????????¨???
	D3 Unit_vec ()
	{
		return D3 ( *this ) / ( *this ).length ();
	}

	//????????????????????????
	D3 Inverse_vec ()
	{
		return D3 ( *this )*-1;
	}

	//?????´????????????
	bool Vertical ( D3 partner )
	{
		return abs ( ( *this ).Inner_product ( partner ) ) < EPS;
	}

	//??????????????????
	bool Parallel ( D3 partner )
	{
		return  ( *this ).Unit_vec () == partner.Unit_vec () || ( *this ).Unit_vec ().Inverse_vec () == partner.Unit_vec ();
	}

};

int main ()
{
	int N;
	cin >> N;
	for( size_t i = 0; i < N; i++ )
	{
		double a[8];
		for( size_t i = 0; i < 8; i++ )
		{
			cin >> a[i];
		}
		D3 A ( a[0] , a[1] ) , B ( a[2] , a[3] ) , C ( a[4] , a[5] ) , D ( a[6] , a[7] );
		D3 AB = B - A;
		D3 CD = D - C;
		if( AB.Parallel ( CD ) )
		{
			cout << "YES" << endl;
		} else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int i,j;
	double x[5],y[5];
	double xx,yy;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<4;j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if(y[0]-y[1]==0 || y[2]-y[3]==0){
			if(y[0]-y[1]==0 && y[2]-y[3]==0){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
		else {
			xx=(y[0]-y[1])/(x[0]-x[1]);
			yy=(y[2]-y[3])/(x[2]-x[3]);
			if(xx==yy){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}	
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;
 
int main(){
    int n;
    cin>>n;
    rep(i,0,n){
        int ans=0;
        double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(x1==x2||x3==x4){
            if(x1==x2&&x3==x4) ans=1;
        }else{
            m1=(y2-y1)/(x2-x1);
            m2=(y4-y3)/(x4-x3);
            if(fabs(m1-m2)<1e-10) ans=1;
        }
        if(ans) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

int digit(int i){
  int c=0;
  do{
    c++;
    i*=0.1;
  }while(i!=0);
  return c;
}

int main(){
  int n;
  cin>>n;
  while(n--){
    int xy[8];
    for(int i=0;i<8;i++){
      int j,s;
      scanf("%d.%d",&j,&s);
      xy[i]=j*pow(10,digit(s))+s;
    }

    //   cout<<xy[0]<<" "<<xy[1]<<" "<<xy[2]<<" "<<xy[3]<<" "<<xy[4]<<" "<<xy[5]<<" "<<xy[6]<<" "<<xy[7]<<endl;
    xy[6] = xy[6] - xy[4] + xy[0];
    xy[7] = xy[7] - xy[5] + xy[1];

    //   cout<<xy[0]<<" "<<xy[1]<<" "<<xy[2]<<" "<<xy[3]<<" "<<xy[4]<<" "<<xy[5]<<" "<<xy[6]<<" "<<xy[7]<<endl;
    //    cout<<xy[2]<<" "<<xy[6]<<" "<<xy[3]<<" "<<xy[7]<<endl;
    if(xy[2] == xy[6] && xy[3] == xy[7]){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }


  }
  return 0;
}