Go: package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var strs []string
	var a, b, c, d, e, f float64
	var x, y float64
	for scanner.Scan() {
		strs = strings.Split(scanner.Text(), " ")
		_a, _ := strconv.Atoi(strs[0])
		_b, _ := strconv.Atoi(strs[1])
		_c, _ := strconv.Atoi(strs[2])
		_d, _ := strconv.Atoi(strs[3])
		_e, _ := strconv.Atoi(strs[4])
		_f, _ := strconv.Atoi(strs[5])
		a = float64(_a)
		b = float64(_b)
		c = float64(_c)
		d = float64(_d)
		e = float64(_e)
		f = float64(_f)
		y = (c*d - f*a) / (d*b - a*e)
		x = (c - b*y) / a

		fmt.Printf("%.3f %.3f\n", x, y)
	}
}

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

int main(){
    	int a, b, c, d, e, f;
	double x, y;
	while(1){
	if (!(cin>>a>>b>>c>>d>>e>>f))break;
		x= round( (double)(1000.0/(a*e-b*d))*(e*c-b*f) ) / 1000.0;
		y= round( (double)(1000.0/(a*e-b*d))*(-d*c+a*f)) / 1000.0;
		cout << fixed << setprecision(3) << (double)x << " " << (double)y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double gcd( double m, double n );
double lcm( double m, double n );
int main(int argc, const char * argv[])
{
    double a=0.0;
    double b=0.0;
    double c=0.0;
    double d=0.0;
    double e=0.0;
    double f=0.0;
    double x=0.0;
    double y=0.0;
    
    while(scanf("%lf",&a)!=EOF){
        scanf("%lf",&b);
        scanf("%lf",&c);
        scanf("%lf",&d);
        scanf("%lf",&e);
        scanf("%lf",&f);
        double ad = lcm( a,d );
        printf("%lf\n",ad);
        
        double a2 = ad/a;
        double b2 = b*a2;
        double c2 = c*a2;
        
        double d2 = ad/d;
        double e2 = e*d2;
        double f2 = f*d2;
        
        y = (c2-f2)/(b2-e2);
        x = (c-b*y)/a;
        
        printf("%.4lf",x);
        printf(" ");
        printf("%.4lf\n",y);
        
    }
    
}
double gcd( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n);
}

C++: #include<cstdio>

int main(int argc, char const *argv[])
{
    double a, b, c, d, e, f;
    while(scanf("%lf %lf %lf %lf %lf %lf", &a,&b,&c,&d,&e,&f) != EOF){
        double x = (e*c-b*f)/(a*e-b*d);
        double y = (-d*c+a*f)/(a*e-b*d);
        if(x==0) x=0;
        if(y==0) y=0;
        printf("%.3lf %.3lf\n", x, y);
    }
    return 0;
}

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;
}