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 <iostream>
#include <cmath>
#include <iomanip>

#define ROUND_RANK 4

//ax+by=c
//dx+ey=f

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& q2, const double& p11, const double& q1, const double& p21) {
	return ((q2*p11 - p21*q1) / det);
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	double	a, b, c, d, e, f;//データセット
	double  det;//行列式
	double	x, y;//解
	std::cin >> a >> b >> c >> d >> e >> f;
	det = Calc_det(a, b, d, e);
	x = Calc_x(det, c, e, b, f);
	y = Calc_y(det, a, f, c, d);
	x = Round(x, ROUND_RANK);
	if (x == 0)x = 0;
	y = Round(y, ROUND_RANK);
	if (y == 0)y = 0;
	std::cout << std::fixed;
	std::cout << std::setprecision(3) << x << " ";
	std::cout << std::setprecision(3) << y << std::endl;
}

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

int main(void){
    double a, b, c, d, e, f, x, y;
    while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
        x = (b*f - c*e)/(b*d - a*e);
        y = (a*f - c*d)/(a*e - b*d);
        if(x == -0) x=0;
        if(y == -0) y=0;
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
    return 0;
}

C++: #include <cstdio>
int main() {
 double a,b,c,d,e,f;
 while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
  printf("%lf %lf\n",(c * e - b * f) / (a * e - b * d),(a*f-d*c)/(a*e-b*d));
 };
 return 0;
};

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
constexpr double eps = 1e-8;

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

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

double round(double num);
/*
??£???????¨????
	ax + by = c
	dx + ey = f
????§£x, y???????????????????????°??????
*/
int main() {
	double a, b, c, d, e, f;
	int cnt = 0;						//??\??????????????£???????¨????????????°
	std::vector<double> x_vector;		//x????§£???????´?
	std::vector<double> y_vector;		//y????§£???????´?

#if 1
	while (cnt < 1) {
		cin >> a >> b >> c >> d >> e >> f;
#else
	while (cin >> a >> b >> c >> d >> e >> f) {
#endif
		double x = (b * f - c * e) / (b * d - a * e);
		double y = (c * d - a * f) / (b * d - a * e);

		cnt++;
		x_vector.push_back(x);
		y_vector.push_back(y);
	}

	for (unsigned int i = 0; i < cnt; i++) {
		double x_result = round(x_vector[i]);
		double y_result = round(y_vector[i]);

		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x_result << " ";
		std::cout << std::setprecision(3) << y_result << endl;
	}

	//???????????°
	//while (1);

	return 0;
}

//?°???°????¬¬4???????????¨?????\????????¢??°
double round(double num) {
	int num_mul_10000 = (int)(double)(num * 10000);
	int num_mul_1000  = (int)(double)(num * 1000);

	//???????????°
	cout << num_mul_10000 << " " << num_mul_1000 << endl;

	if (5 <= (num_mul_10000 - num_mul_1000 * 10)) {
		return num + 0.001;
	}
	else {
		return num;
	}
}

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

int main(){

	float a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f)
	{
		printf("%.3f %.3f\n",(c*e - b*f) / (e*a - b*d),(d*c - a*f) / (b*d - a*e));
	}
    return 0;
}

C++: from sympy import *

a, b, c, d, e, f = map(int, raw_input().strip().split(' '))

x, y = symbols('x y')

# ax + by = c
# dx + ey = f
res = solve((a*x+b*y - c , d*x+e*y - f), x, y)
x = res[x]
y = res[y]
x = float(str(x))
y = float(str(y))
print "%.3f %.3f" % (x, y)

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

int main() {
	double a, b, c, d, e, f, x, y;
	cout << fixed << setprecision(3);
	while (cin >> a >> b >> c >> d >> e >> f) {
		x = (c * e - b * f) / (a * e - b * d);
		y = (c - a * x) / b;
		x *= 1000; x = x + (x > 0 ? 0.5 : -0.5); x = (int)x;
		y *= 1000; y = y + (y > 0 ? 0.5 : -0.5); y = (int)y;
		cout << x / 1000 << " " << y / 1000 << endl;
	}
	return 0;
}

C++: #include <cstdio>

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

C++: #include <bits/stdc++.h>

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b, c, d, e, f;
    double den, x, y;

    while (true) {
        cin >> a >> b >> c >> d >> e >> f;
        if (cin.eof()) { break; }
        den =  a * e - b * d;
        x = static_cast<double>(c * e - b * f) / den;
        y = static_cast<double>(- c * d + a * f) / den;
        // avoid -0.000
        x += 0.0;
        y += 0.0;
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }

    return 0;
}

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

int main()
{
	double a[6], x, y;

	while(cin>>a[0]){
		for(int i = 1; i < 6; i++){
			cin>>a[i];
		}
		y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4]);
		x = (a[2]-a[1]*y)/a[0];


		if(x >= 0) x = ((double)((int)(x*1000+0.5)))/1000;
		else x = ((double)((int)(x*1000-0.5)))/1000;
		if(y >= 0) y = ((double)((int)(y*1000+0.5)))/1000;
		else y = ((double)((int)(y*1000+0.5)))/1000;

		printf("%.03f %.03f\n", x, y);
	}
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
#define rep(i,a,b) for(int i = (a); i<=(b); i++)
using namespace std;
const int num = 100;
double matrix[num][num + 1];   //邉サ謨ー遏ゥ髦オ?御サ?蠑?ァ?double ans[num];               //扈捺棡謨ー扈?
void exchange_col(int p1,int p2,int n)  //莠、謐「p1陦悟柱p2陦檎噪謇?怏謨ー謐ョ
{
    double t;
    int i;
    for(i = 0 ; i <= n ; i++)
        t = matrix[p1][i],matrix[p1][i] = matrix[p2][i],matrix[p2][i] = t;
}

bool gauss(int n)   //豎りァ」邉サ謨ー遏ゥ髦オ荳コn逧?コソ諤ァ譁ケ遞狗サ?{
    int i,j,k;
    int p;
    double r;

    for(i = 0 ; i < n - 1 ; i++)
    {
        p = i;
        for(j = i + 1 ; j < n ; j++)     //蟇サ謇セi蛻玲怙螟ァ蛟シ菴咲スョ
        {
            if(matrix[j][i] > matrix[p][i])
                p = j;
        }
        if(matrix[p][i] == 0) return false;
        if(p != i)     exchange_col(i,p,n);
        for(j = i + 1 ; j < n ; j++)         //蜑ゥ菴吝?霑幄。梧カ亥?
        {
            r = matrix[j][i] / matrix[i][i];
            for(k = i ; k <= n ; k++)
                matrix[j][k] -= r * matrix[i][k];
        }
    }
    for(i = n - 1 ; i >= 0 ; i--)     //闔キ蠕礼サ捺棡
    {
        ans[i] = matrix[i][n];
        for(j = n - 1 ; j > i ; j--)
            ans[i] -= matrix[i][j] * ans[j];
        ans[i] /= matrix[i][i];
    }
    return true;
}
int main()
{
    int i,j,t;
    while(scanf("%lf",&matrix[0][0])!=-1)
    {
        rep(i,1,2) scanf("%lf",&matrix[0][i]);
        rep(i,0,2) scanf("%lf",&matrix[1][i]);
        gauss(2);
        printf("%.3lf %.3lf\n",ans[0],ans[1]);
    }
    return 0;
}