Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		lcm := lcm(a, d)
		mulA := lcm / a
		mulD := lcm / d
		a *= mulA
		b *= mulA
		c *= mulA
		d *= mulD
		e *= mulD
		f *= mulD

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		y := cF / bE
		x := (c - (y * b)) / a

		fmt.Printf("%d.000 ", x)
		fmt.Printf("%d.000\n", y)
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 (b<a) { a=b; return 1; } return 0; }
       
       
template <typename T>
class Matrix {
  vector<vector<T>> A;

 public:
  Matrix(size_t n, size_t m, T v = 0) : A(n, vector<T>(m, v)){};
  Matrix(initializer_list<initializer_list<T>> B) : A(B.begin(), B.end()){};

  size_t height() const { return A.size(); }

  size_t width() const { return A[0].size(); }

  inline const vector<T> &operator[](int k) const { return A[k]; }
  inline vector<T> &operator[](int k) { return A[k]; }

  static Matrix I(size_t n) {
    Matrix m(n, n, 0);
    for (int i = 0; i < n; ++i) m[i][i] = 1;
    return m;
  }

  Matrix &operator+=(const Matrix &B) {
    size_t n = height(), m = width();
    assert(n == B.height() && m == B.width());
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        (*this)[i][j] += B[i][j];
      }
    }
    return (*this);
  }

  Matrix &operator-=(const Matrix &B) {
    size_t n = height(), m = width();
    assert(n == B.height() && m == B.width());
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        (*this)[i][j] -= B[i][j];
      }
    }
    return (*this);
  }

  Matrix &operator*=(const Matrix &B) {
    size_t n = height(), l = width(), m = B.width();
    assert(l == B.height());
    vector<vector<T>> C(n, vector<T>(m, 0));
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        for (int k = 0; k < l; ++k) {
          C[i][j] += (*this)[i][k] * B[k][j];
        }
      }
    }
    A.swap(C);
    return (*this);
  }

  Matrix operator+(const Matrix &B) const { return (Matrix(*this) += B); }

  Matrix operator-(const Matrix &B) const { return (Matrix(*this) -= B); }

  Matrix operator*(const Matrix &B) const { return (Matrix(*this) *= B); }

  Matrix power(long long r) const {
    assert(height() == width());
    Matrix A(*this), B(Matrix::I(height()));
    while (r > 0) {
      if (r & 1) B *= A;
      A *= A;
      r >>= 1;
    }
    return B;
  }

  friend ostream &operator<<(ostream &os, const Matrix &A) {
    size_t n = A.height(), m = A.width();
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (j != 0) os << " ";
        os << A[i][j];
      }
      os << endl;
    }
    return os;
  }

  friend istream &operator>>(istream &is, Matrix &A) {
    size_t n = A.height(), m = A.width();
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        is >> A[i][j];
      }
    }
    return is;
  }
};
       
class GaussJordan {
  int _rank;
  Matrix<double> D;

  bool isZero(double v) { return abs(v) < 1e-10; }

 public:
  GaussJordan(const Matrix<double>& A, bool extended = false) : D(A), _rank(0) {
    int H = D.height(), W = D.width();
    for (int col = 0; col < W; ++col) {
      if (extended && col == W - 1) break;
      int pivot = -1;
      for (int row = _rank; row < H; ++row) {
        if (!isZero(D[row][col])) {
          pivot = row;
          break;
        }
      }
      if (pivot == -1) continue;
      swap(D[pivot], D[_rank]);

      for (int col2 = W - 1; col2 >= col; --col2)
        D[_rank][col2] /= D[_rank][col];

      for (int row = 0; row < H; ++row) {
        if (row != _rank && !isZero(D[row][col])) {
          auto r = D[row][col];
          for (int col2 = 0; col2 < W; ++col2) {
            D[row][col2] -= D[_rank][col2] * r;
          }
        }
      }
      ++_rank;
    }
  }

  inline const auto& operator[](int row) const { return D[row]; }
  int rank() { return _rank; }
};
template <typename T>
class LinearEquation {
  vector<T> _ans;
  bool _solvable;

 public:
  LinearEquation(Matrix<T> A, vector<T> b) {
    int m = A.height(), n = A.width();
    Matrix<T> M(m, n + 1);
    for (int i = 0; i < m; ++i) {
      for (int j = 0; j < n; ++j) M[i][j] = A[i][j];
      M[i][n] = b[i];
    }

    GaussJordan C(M, true);

    _solvable = true;
    for (int row = C.rank(); row < m; ++row) {
      if (C[row][n]) _solvable = false;
    }

    _ans.resize(n, 0);
    for (int i = 0; i < C.rank(); ++i) _ans[i] = C[i][n];
  }

  bool solvable() { return _solvable; }

  T operator[](int i) const { return _ans[i]; }
};

int main() {
  Matrix<double> A(2, 2);
  vector<double> b(2);

  while (true) {
    for (int i = 0; i < (int)2; ++i) {
      for (int j = 0; j < (int)2; ++j) cin >> A[i][j];
      cin >> b[i];
    }
    if (cin.eof()) break;
    LinearEquation<double> le(A, b);
    printf("%.3lf %.3lf\n", le[0], le[1]);
  }

  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include    <iomanip>
using namespace std;

int main(){

    double a,b,c,d,e,f,y,x,bb,cc,dd,ee,ff;
    while(cin>>a>>b>>c>>d>>e>>f){
        bb=b/a;
        cc=c/a;
        ee=e/d;
        ff=f/d;
        y=(cc-ff)/(bb-ee);
        x=(c-b*y)/a;
        cout<<fixed<<setprecision( 3 )<<x<<" "<<y<<endl;
        //printf("%f %f\n",x,y);
    }
    return 0;
}

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

int main(){
	while (1){
		double a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;

		double x = (c*e - f*b) / (a*e - b*d);
		cout << fixed << setprecision(3)<< x << " " << fixed << setprecision(3)<< (c - a*x) / b;
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>

using namespace std;
double sg(double n); 
int main()
{
	int a[1000],b[1000],c[1000],d[1000],e[1000],f[1000];
	float x[1000],y[1000];
	int w_x,w_y;
	int len=0;
	while (cin >> a[len] >> b[len] >> c[len] >> d[len] >> e[len] >> f[len])
		len++;

	for (int i=0; i < len; i++) {
		x[i] =  ((e[i] * c[i] - b[i] * f[i]) / (e[i] * a[i] - b[i] * d[i]));
		y[i] =  ((c[i] * d[i] - f[i] * a[i]) / (b[i] * d[i] - a[i] * e[i]));
	}
	for (int i=0; i < len; i++) {
		printf("%.3lf %.3lf\n",sg(x[i]),sg(y[i]));
	}
	return 0;
}
double sg(double n)
{
	int w;
	n = n * 10000;
	w = (int)n % 10;
	n /= 10000;
	if (w > 4) 
		n += 1.0;
	return n;
}

C++: #include<stdio.h>
int main(void)
{
	float e2,f2,c2;
	float a1,b1,c1,d1,e1,f1;
	float a,b,c,d,e,f;
	float add,x,y;
	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f)!=EOF){
		add=a/d;
		a1=a;
		b1=b;
		c1=c;
		d1=d*add;
		e1=e*add;
		f1=f*add;
		e2=b-e1;
		f2=c-f1;
		y=f2/e2;
		add=b/e;
		a1=a;
		b1=b;
		c1=c;
		d1=d*add;
		e1=e*add;
		f1=f*add;
		a1=a-d1;
		c2=c-f1;
		x=c2/a1;
		printf("%0.3f %0.3f\n",x,y);
	}
	return 0;
}
/*
1x+2y=3
4x+5y=6
a  b  c
1x+2y=3;
1.6x+2y=1.2
d    e   f
-0.4x=1.8
*/