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>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    if(a[0]-b[0]==0&&c[0]-d[0]==0) cout << "YES" << endl;
    else if(a[1]-b[1]==0&&c[1]-d[1]==0) cout << "YES" << endl;
    if(a[0]-b[0]!=0&&c[0]-d[0]!=0){
      bool ok = false;
      if((b[1]-a[1])/(b[0]-a[0])==(d[1]-c[1])/(d[0]-c[0])){
	cout << "YES" << endl;
	ok = true;
      }
      if(!ok) cout << "NO" << endl;
    }
    else cout << "NO" << endl;
  }   
  return 0;
}

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

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

int main(){
	int n;
	double t[100][8];
	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 8; j++){
			cin >> t[i][j];
		}
	}
	for(int i = 0; i < n; i++){
		if(t[i][0] == t[i][2]){
			if(t[i][4] == t[i][6]){
				cout << "YES" << endl;
			}
			else{
				cout << "NO" << endl;
			}
		}
		else if(t[i][1] == t[i][3]){
			if(t[i][5] == t[i][7]){
				cout << "YES" << endl;
			}
			else{
				cout << "NO" << endl;
			}
		}
		else if((t[i][1]-t[i][3])/(t[i][0]-t[i][2]) == (t[i][5]-t[i][7])/(t[i][4]-t[i][6])){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4, v_ab, v_cd;
	double del, eps;
	eps = 0.000001;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
	
		v_ab.x = p1.x - p2.x;
		v_ab.y = p1.y - p2.y;
		v_cd.x = p3.x - p3.y;
		v_cd.y = p4.x - p4.y;
		
		del = v_ab.x * v_cd.y - v_ab.y * v_cd.x;
		if(abs(del) < eps) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;

}

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

int main(){
	float x1,x2,x3,x4,y1,y2,y3,y4;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
			scanf("%f %f %f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		if( ((y1-y2)==0&&(y3-y4)!=0&&(x1-x2)==0&&(x3-x4)!=0) || ((x1-x2)!=0&&(x3-x4)==0&&(y1-y2)==0&&(y3-y4)!=0)){
			
				printf("NO\n");
		}
			else if((y1-y2)*(x3-x4)==(x1-x2)*(y3-y4)){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
	
	return 0;
}

C++: /*AOJ 0021*/

#include<iostream>
using namespace std;

class point_obj{
public:
	double x,y;
};

int main(){

	int n;
	point_obj p[4];


	cin>>n;

	for(int i=0;i<n;i++){

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

		if( p[1].x - p[0].x == 0){
			if(p[3].x-p[2].x == 0){
				cout<<"YES"<<endl;
			}

			else{
				cout<<"NO"<<endl;
			}

		}

		else{
			double tmp0 = (p[1].y - p[0].y)/(p[1].x - p[0].x);
			if(p[3].x-p[2].x == 0){
				cout<<"NO"<<endl;
			}
			else{
				double tmp1 = (p[3].y - p[2].y)/(p[3].x-p[2].x);
				if(tmp0 == tmp1){
					cout<<"YES"<<endl;
				}
				else{
					cout<<"NO"<<endl;
				}
			}
		}
	}

	return 0;
}

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

#define infinity INT_MAX

int main()
{
	int n;
	std::cin >> n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double at_x_zero_ab, at_x_zero_cd;
	double slope_ab, slope_cd;
	for (int i = 0; i < n; i++) {
		std::cin >> x1 >> y1 >> x2 >> y2
                 >> x3 >> y3 >> x4 >> y4;
		if (x2 -x1 == 0) {
			slope_ab = infinity;
		} else {
			slope_ab = (y2 - y1) / (x2 - x1);
		}
		if (x4 - x3 == 0) {
			slope_cd = infinity;
		} else {
			slope_cd = (y4 - y3) / (x4 - x3);
		}
		at_x_zero_ab = y1 - slope_ab * x1;
		at_x_zero_cd = y3 - slope_cd * x3;
		if (slope_ab == slope_cd && slope_ab != infinity) {
			if (at_x_zero_ab == at_x_zero_cd) {
				std::cout << "NO\n";
			} else {
				std::cout << "YES\n";
			}
		} else if (slope_ab == slope_cd && slope_ab == infinity) {
			if (x1 == x3) {
				std::cout << "NO\n";
			} else {
				std::cout << "YES\n";
			}
		} else {
			std::cout << "NO\n";
		}
	}
	return 0;
}