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 <cmath>
#define EPS 1e-10
using namespace std;

struct P {
  P(){}
  double x,y;
  P(double x,double y):x(x),y(y){}
};

double det(P ab,P cd){
  return ab.x * cd.y - ab.y*cd.x; 
}
int main(){
  P a,b,c,d;
  int n;
  cin >> n;
  while(n--) {
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
    P ab,cd;
    ab = P(b.x - a.x,b.y - a.y);
    cd = P(d.x - c.x,d.y - c.y);
    if(abs(det(ab,cd)) < EPS)cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

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

C++: #include <iostream>

using namespace std;

class Vector2D {
  private:
    double x;
    double y;
  public:
    Vector2D(double, double);
    Vector2D operator - (Vector2D vec2) {
      double newX = this->x - vec2.x;
      double newY = this->y - vec2.y;
      Vector2D newvec(newX, newY);
      return newvec;
    }
    double GetX() { return x; };
    double GetY() { return y; };
    bool isParallel(Vector2D);
};

Vector2D::Vector2D(double _x, double _y) {
  x = _x;
  y = _y;
}

bool Vector2D::isParallel(Vector2D vec2) {
  if (vec2.GetY()/this->y == vec2.GetX()/this->x)
    return true;
  else
    return false;
}

int main() {
  int n;
  cin >> n;

  double x1,y1,x2,y2,x3,y3,x4,y4;
  for (int dataset_i = 0; dataset_i < n; dataset_i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    Vector2D vecAB = Vector2D(x2,y2) - Vector2D(x1,y1);
    Vector2D vecBD = Vector2D(x4,y4) - Vector2D(x3,y3);
    cout << (vecAB.isParallel(vecBD) ? "YES" : "NO") << endl;
  }

  return 0;
}

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

bool Func(double x1, double x2, double y1, double y2, double x, double y) {
	return (x2 - x1)*(y - y1) != (y2 - y1)*(x - x1);
}

int main() {
	double x[4], y[4];
	double dx[2], dy[2];
	int n;

	scanf("%d", &n);
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < 4;k++) {
			scanf("%lf%lf", x + k, y + k);
		}
		dx[0] = x[1] - x[0];dy[0] = y[1] - y[0];
		dx[1] = x[3] - x[2];dy[1] = y[3] - y[2];

		if (dx[0] * dy[1] == dx[1] * dy[0] && Func(x[0], x[1], y[0], y[1], x[2], y[2])) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}

	return 0;
}

C++: require("fs").readFileSync("/dev/stdin","utf8").trim().split('\n').some(function(i){c=i.split(' ');console.log(((c[3]-c[1])/(c[2]-c[0])).toFixed(6)==((c[7]-c[5])/(c[6]-c[4])).toFixed(6)?'YES':'NO')})

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

int main(){

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

    cin>>n;

    for(int i=0; i<n; i++){
      cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
      if(fabs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<=0.00000001)cout << "YES" << endl;
      else cout << "NO" << endl;
    }


  return 0;
}

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

#define EPS 1e-10
using namespace std;

typedef complex<double> P;


double cross(P p1,P p2){
	return p1.real()*p2.imag()-p1.imag()*p2.real();
}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		P p[2];
		for(int i=0;i<2;i++){
			P tp[2];
			for(int j=0;j<2;j++){
				cin>>tp[j].real()>>tp[j].imag();
			}
			p[i]=tp[1]-tp[0];
		}
		if(abs(cross(p[0],p[1]))<=EPS)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	while (n--) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>
??
using namespace std;
??
??
int main()
{
????????int num;
????????double sx1, sy1, sx2, sy2;
????????double ex1, ey1, ex2, ey2;
??
????????cin >> num;
??
????????for(int i = 0; i < num; i++)
????????{
????????????????cin >> sx1 >> sy1 >> sx2 >> sy2 >> ex1 >> ey1 >> ex2 >> ey2;
??
????????????????if( (sy2-sy1)/(sx2 - sx1) == (ey2-ey1)/(ex2-ex1))
????????????????{
????????????????????????cout << "YES" << endl;
????????????????}
????????????????else
????????????????{
????????????????????????cout << "NO" << endl;
????????????????}
????????}
}

C++: #include <iostream>
#include <float.h>
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 ab_slope = (y2-y1)/(x2-x1);
		double cd_slope = (y4-y3)/(x4-x3);
		if(ab_slope - cd_slope <= DBL_EPSILON){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		
	}
	return 0;
}

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

int main(void) {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        double point[4][2];
        for(int j = 0; j < 4; j++){
            for(int k = 0; k < 2; k++){
                cin >> point[j][k];
            }
        }
        if(((point[1][0] - point[0][0]) / (point[1][1] - point[0][1])) == ((point[3][0] - point[2][0]) / (point[3][1] - point[2][1]))){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
class Point {
public:
	double x, y;
};
int main() {
	int n; cin >> n;
	while (n--) {
		Point a, b, c, d;
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		b.x -= a.x; a.x = 0;
		b.y -= a.y; a.y = 0;
		d.x -= c.x; c.x = 0;
		d.y -= c.y; c.y = 0;
		double z = b.x*d.y - b.y*d.x;
		if (z == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}