Go: package main

import "fmt"

func main() {

	for {
		var a, b, c, d, e, f float64
		var x, y float64
		i, _ := fmt.Scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)
		if i != 6 {
			return
		}

		// x = ((e * c) - (b * f)) / ((a * e) - (b * d))
		y = ((a * f) - (d * c)) / ((a * e) - (b * d))
		x = (c - b*y) / a

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

C++: #include <stdio.h>
#include <math.h>

int main(int argc, char** argv)
{
  double a, b, c, d, e, f;
  
  while (fscanf(stdin, "%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == 6) {
    double x = (c * e - b * f) / (a * e - b * d);
    double y = (f - d * x) / e;
    
    x = fabs(x) < 0.001 ? 0.0 : x;
    y = fabs(y) < 0.001 ? 0.0 : y;

    fprintf(stdout, "%.3lf %.3lf\n", x, y);
  }
}

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

int main(void) {
    int a,b,c,d,e,f;
    float x,y;
    while (1){
        cin >> a;
        if (cin.eof())
            break;
        cin >> b >> c >> d >> e >> f;
        x=(e*c-b*f)/(a*e-b*d);
        y=(-d*c+a*f)/(a*e-b*d);
        printf("%.3f %.3f\n",x,y);
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(){
    double a,b,c,d,e,f;
    while(cin >> a >>b >> c >> d >> e >> f){
    double det,x,y;
    det = a*e-b*d;
    x = (e*c-b*f)/det;
    y = (-c*d+a*f)/det;
    if (x==0)
        x = fabs(x);
    if (y==0)
        y = fabs(y);
    printf("%.3f\t%.3f\n",x,y);}
}

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

int main(int argc, char const *argv[]){
	
	double a,b,c,d,e,f;

	while(std::cin >> a >> b >> c >> d >> e >> f){
		double y = (a*f-c*d)/(a*e-b*d);
		double x = (c-b*y)/a;
		std::cout << std::fixed << std::setprecision(3) << x << " " << y << std::endl;
	}

	return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

double a, b, c;
double d, e, f;

int main()
{
  while(cin >> a >> b >> c >> d >> e >> f){
    double x = (e*c-b*f) / (e*a-b*d);  if(abs(x) < EPS) x = 0.0;
    double y = (c*d-a*f) / (b*d-a*e);  if(abs(y) < EPS) y = 0.0;
    printf("%.3f %.3f\n", x, y);
  }

  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999

const double EPS = 1e-8;
typedef vector<double> vd;
typedef vector<vd> mat;

//Ax=b????§£??? A?????£?????????
//?§£??????or????????§?????? ??´????????????0???vector?????????
vd gauss_jordan(const mat& A, const vd& b){
    int n=A.size();
    mat B(n,vd(n+1));
    rep(i,n) rep(j,n) B[i][j]=A[i][j];
    
    //??????A????????????b?????????????????????????????????
    rep(i,n) B[i][n] = b[i];
    
    rep(i,n){
        //??¨????????????????????°????????°?????¶???????????§????????????i??????????????£?????????
        int pivot = i;
        for(int j=i;j<n;j++){
            if(abs(B[j][i])>abs(B[pivot][i]))pivot = j;
        }
        swap(B[i],B[pivot]);
        
        //?§£??????or????????§??????
        if(abs(B[i][i])<EPS)return vd();
           
        //??¨????????????????????°????????°???1?????????
        for(int j=i+1;j<=n;j++)B[i][j]/=B[i][i];
        rep(j,n){
            if(i!=j){
                //j??????????????°????¶????
                for(int k=i+1;k<=n;k++)B[j][k]-=B[j][i]*B[i][k];
            }
        }
    }
    vd x(n);
    //??????????????????b????§£?????????
    rep(i,n)x[i]=B[i][n];
    return x;
}


int main(){
    int a,b,c,d,e,f;
    while(cin>>a>>b>>c>>d>>e>>f){
        vd vec;
        vec.pb(c);
        vec.pb(f);
        mat mvec;
        vd x,y;
        x.pb(a);
        x.pb(b);
        y.pb(d);
        y.pb(e);
        mvec.pb(x);
        mvec.pb(y);
        vd res = gauss_jordan(mvec, vec);
        printf("%.3lf %.3lf\n",res[0],res[1]);
    }
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>

using namespace std;

int det(int a, int b, int c, int d) {
	return a * d - b * c;
}

int main() {
	int a[6];
	while(cin) {
		for(int i = 0; i < 6; i++)
			cin >> a[i];
		int d = det(a[0], a[1], a[3], a[4]);
		int x1 = det(a[2], a[1], a[5], a[4]);
		int x2 = det(a[0], a[2], a[3], a[5]);
		cout << setprecision(3) << fixed << 1. * x1 / d + 1e-9 << " ";
		cout << setprecision(3) << fixed << 1. * x2 / d + 1e-9 << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <math.h>

int main(){
  int a, b, c, d, e, f;
  scanf("%d ",&a);
  scanf("%d ",&b);
  scanf("%d ",&c);
  scanf("%d ",&d);
  scanf("%d ",&e);
  scanf("%d ",&f);
  
  double x, y;
  x = (double)(c*e-b*f) / (double)(a*e-b*d);
  y = (double)(a*f-c*d) / (double)(a*e-b*d);
  x = (double)round(x*10000.0) / 10000.0;
  y = (double)round(y*10000.0) / 10000.0;
  printf("%f.3 %f.3\n", x, y);
  
  return 0;
}

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

int main(){
  double a, b, c, d, e, f, x, y;
  cin >> a >> b >> c >> d >> e >> f;   
  y = (f-(d*c)/a)/(e-(d*b)/a);
  x = (c-b*y)/a;
  cout << fixed << setprecision(3) << x << " " << y << endl;
  cin >> a >> b >> c >> d >> e >> f;   
  y = (f-(d*c)/a)/(e-(d*b)/a);
  x = (c-b*y)/a;

  cout << fixed << setprecision(3) << x << " " << y << endl;
    
    
    
  return 0;

}

C++: #include <iostream>
#include <cstdio>
#include <vector> 
#include <iomanip>
#include <cmath>

int rintv(double v) 
{
	return (v > 0) ? ((int)(v + 0.5)) : ((int)(v - 0.5)); 
}

double round_off(int dec_p, double value)
{
	double shift = pow(10, -dec_p);
	int intv = rintv(shift * value);
	return intv / shift;
}

int main()
{
	std::vector<double> x, y;
	double a, b, c, d, p, q;
	while (scanf("%d %d %d %d %d %d", &a, &b, &p, &c, &d, &q) != EOF)
	{
		x.push_back((d*p - b*q) / (a*d - b*c));
		y.push_back((a*q - c*p) / (a*d - b*c));
	}

	for (int i = 0; i < x.size(); ++i)
		std::cout << round_off(-5, x[i]) << " " << round_off(-5, y[i]) << std::endl;
	return 0;
}