Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &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)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;

#define X real()
#define Y imag()

typedef complex<double> P;
struct L{
	P p1, p2;
	L(P p1, P p2):p1(p1), p2(p2){}
	L(){}
};
istream& operator>>(istream &is, P &p) {
	double x, y;
	is >> x >> y;
	p = P(x, y);
	return is;
}
inline int sig(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
inline double norm(const P &p){return p.X*p.X+p.Y*p.Y;}
inline double inp(const P& a, const P& b){return (conj(a)*b).X;}
inline double outp(const P& a, const P& b){return (conj(a)*b).Y;}


int T;

int main(){
	ios::sync_with_stdio(false);
	cin >> T;
	while(T--){
		P p1, p2, p3, p4;
		cin >> p1 >> p2 >> p3 >> p4;
		p2 -= p1; p4 -= p3;
		puts(!sig(inp(p2, p4*P(0, 1))) ? "YES" : "NO");
	}
	return 0;
}

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

struct Point {
  using P = Point;
  double x;
  double y;
  double z;
  Point(double _x = 0.0, double _y = 0.0, double _z = 0.0)
      : x(_x), y(_y), z(_z) {}

  // NOTICE: if you use 3d vector, change THIS!!
  friend istream& operator>>(istream& input, P& p) {
    return input >> p.x >> p.y, p.z = 0, input;
  }
  friend ostream& operator<<(ostream& output, const P& p) {
    return output << '(' << p.x << ", " << p.y << ')';
  }
  P operator+(const P& p) const { return P(x + p.x, y + p.y, z + p.z); }
  P operator-(const P& p) const { return P(x - p.x, y - p.y, z - p.z); }
  P operator*(const double& k) const { return P(x * k, y * k, z * k); }
  P operator/(const double& k) const { return P(x / k, y / k, z / k); }
  P& operator+=(const P& p) { return *this = *this + p; }
  P& operator-=(const P& p) { return *this = *this - p; }
  P& operator*=(const double& k) { return *this = *this * k; }
  P& operator/=(const double& k) { return *this = *this / k; }
  bool operator<(const P& p) const { return lt(z, p.z); }
  bool operator==(const P& p) const {
    return eq(x, p.x) && eq(y, p.y) && eq(z, p.z);
  }
  bool operator>(const P& p) const { return !(*this < p || *this == p); }
  double abs() const { return sqrt(norm()); }
  double norm() const { return x * x + y * y + z * z; };
  double dot(const P& p) const { return x * p.x + y * p.y + z * p.z; }
  P cross(const P& p) const {
    double a = y * p.z - z * p.y;
    double b = z * p.x - x * p.z;
    double c = x * p.y - y * p.x;
    return P(a, b, c);
  }
  bool isOrthogonal(const P& p) const { return eq(dot(p), 0.0); }
  bool isParallel(const P& p) const { return cross(p) == P(0.0, 0.0, 0.0); }

  static double EPS;
  static bool eq(const double& a, const double& b) {
    return std::abs(a - b) < EPS;
  }
  static bool lt(const double& a, const double& b) { return a - b < -EPS; }
  static bool le(const double& a, const double& b) { return a - b < EPS; }
  static int ccw(P a, P b, P c) {
    b -= a;
    c -= a;
    if (b.cross(c) > P(0.0, 0.0, 0.0)) return +1;  // counter clockwise
    if (b.cross(c) < P(0.0, 0.0, 0.0)) return -1;  // clockwise
    if (lt(b.dot(c), 0.0)) return +2;              // on line back
    if (lt(b.norm(), c.norm())) return -2;         // on line front
    return 0;                                      // on segment
  }
  static bool intersect(const P& a1, const P& a2, const P& b1, const P& b2) {
    return ccw(a1, a2, b1) * ccw(a1, a2, b2) <= 0 &&
           ccw(b1, b2, a1) * ccw(b1, b2, a2) <= 0;
  }
  static vector<P> convexHull(vector<P> ps) {
    int n = ps.size(), k = 0;
    sort(begin(ps), end(ps));
    vector<P> ch(n * 2);
    for (int i = 0; i < n; ch[k++] = ps[i++]) {
      while (k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
    }
    for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--]) {
      while (k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
    }
    ch.resize(k - 1);
    return ch;
  }
};
double Point::EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    Point a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (((b - a).isParallel(d - c)) ? "YES" : "NO") << endl;
  }
}

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

int main()
{
  double x1, x2, x3, x4, y1, y2, y3, y4;
  int n;

  cin >> n;

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

  return 0;
}