Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

using P = complex<double>;

double cross(P p1, P p2) {
    return (p1.real() * p2.imag() - p1.imag() * p2.real());
}

int main() {
    int n;
    cin >> n;
    while (n--) {
	double x[4], y[4];
	for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
	P pp[4];
	for (int i = 0; i < 4; i++) pp[i] = P(x[i], y[i]);
	if (cross(pp[1] - pp[0], pp[3] - pp[2]) < 1e-10) {
	    cout << "YES" << endl;
	}
	else {
	    cout << "NO" << endl;
	}
    }
    return 0;
}

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

using namespace std;
#define EPS 0.0000001
int main(){

	int n; cin >> n;
	double x[4],y[4]; //??\????????§?¨?

	for(int i=0;i<n;i++){
		for(int j=0;j<4;j++){
			cin >> x[j] >> y[j];
		}

		if( abs((y[0]-y[1])*(x[3]-x[2]) + (x[0]-x[1])*(y[2]-y[3])) < EPS  ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;++i){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    double vx = x2-x1 , vy = y2-y1;
    double ux = x4-x3 , uy = y4-y3;
    if(abs(vx*uy-ux*vy)<1.e-10){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

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


int main(){
  int n; cin >>n;
  for(int i=0; i<n; i++){
    float x1, y1, x2, y2, x3, y3, x4, y4;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    if((x2-x1)*(y3-y4)-(y2-y1)*(x3-x4) == 0){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };

int n;
double x, x2, x3, x4, y, y2, y3, y4;

int main() {
	scanf( "%d", &n );
	for ( int i = 0; i < n; i++ ) {
		scanf( "%lf %lf %lf %lf %lf %lf %lf %lf", &x, &y, &x2, &y2, &x3, &y3, &x4, &y4 );
		if ( fabs( ( x2 - x ) * ( y4 - y3 ) - ( x4 - x3 ) * ( y2 - y ) ) < EPS ) {
			printf( "YES\n" );
		}
		else {
			printf( "NO\n" );
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
 
using namespace std;
 
int main (void) {
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int n;
    
  cin >> n;
   
  for(int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    double t1 = (y1-y2)/(x1-x2);
    double t2 = (y3-y4)/(x3-x4);
    //cout << t1 << " " << t2 << endl;
    if ( t1 == t2 ) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
   
  return 0;
}