Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var a, b, c, d, e, f float64
        sc := bufio.NewScanner(os.Stdin)
        for sc.Scan() {
                fmt.Sscanf(sc.Text(), "%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)

                det := a*e - b*d
                x := (e*c - b*f) / det
                y := (a*f - c*d) / det
                fmt.Printf("%04f %04f\n", x, y)
        }
}

C++: #include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

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

C++: import sys
 
for line in sys.stdin:
    a, b, c, d, e, f = map(float, line.split())
 
    x = (c * e - b * f)/(a * e - b * d)
    y = (a * f - c * d)/(a * e - b * d)
    print '%f %f' % (x, y)

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

using namespace std;
 
#define N 2

int main(void)
{
	double a[N][N+1];
	int i, j, k;
	for( i=0; i<N; i++ ){
		for( j=0; j<N+1; j++ ){
			cin >> a[i][j];
		}
	}

	double p, d;
	for( k=0; k<N; k++ ){
		p = a[k][k];
		for( i=0; i<N+1; i++ )
			a[k][i] /= p;
		for( i=0; i<N; i++ ){
			if( i != k ){
				d = a[i][k];
				for( j=0; j<N+1; j++ ){
					a[i][j] -= a[k][j]*d;
				}
			}
		}
	}

	cout << setprecision(3) << setiosflags(ios::fixed);
	cout << a[0][N] << " " << a[1][N] << endl;

	return 0;
}

C++: #include <iostream>

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

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

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 << roundf(x[i]+0.00005) << " " << roundf(y[i]+ 0.00005) << std::endl;
	return 0;
}

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);
	det = fabs(det);
	x = Calc_x(det, c, e, b, f);
	y = Calc_y(det, a, f, c, d);
	x = Round(x, ROUND_RANK);
	y = Round(y, ROUND_RANK);
	std::cout << std::fixed;
	std::cout << std::setprecision(3) << x << " ";
	std::cout << std::setprecision(3) << y << std::endl;
}

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

int main(){
	double x, y;
	int a, b, c, d, e, f;

	while(cin >> a >> b >> c >> d >> e >> f){
		double p = (double)e/(double)b;
		x = (p*(double)c-f)/(p*(double)a-(double)d);
		y = ((double)c-double(a)*x)/(double)b;

		cout << x << ' ' << y << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<iomanip>
#define x_Formula(a,b,c,d,e,f) (c-(b*f)/e)/(a-(b*d)/e);
#define y_Formula(x,a,b,c) (c-(a*x))/b;

using namespace std;

double x;
double y;

void serch()
{
	int xx,yy;
	xx=x*10000;
	yy=y*10000;
//	cout << xx << " " << yy << endl;
	if(xx>0)
		xx+=5;
	else
		xx-=5;
	if(yy>0)
		yy+=5;
	else
		yy-=5;
	x=xx/10000;
	y=yy/10000;
//	cout << xx << " " << yy << endl;

}
int main()
{
	double num[6];
	int i;
	
	for(;cin >> num[0];)
	{
		for(i=1;i<6;i++)
			cin >> num[i];
		
		x=x_Formula(num[0],num[1],num[2],num[3],num[4],num[5])
		y=y_Formula(x,num[0],num[1],num[2])
		
		cout << setprecision(3);
		cout << setiosflags(ios::scientific);
		cout << fixed ;
		serch();
		cout << x << " " << y << endl;
	}
}

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

using namespace std;

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

  while (cin >> a >> b >> c >> d >> e >> f) {
    a -= d * b / e;
    c -= f * b / e;
    double x = c / a;
    double y = (f - d * x) / e;
    if (x == -0.0)
      x = 0.0;
    if (y == -0.0)
      y = 0.0;
    printf("%.3lf %.3lf\n", x, y);
  }
  return 0;
}

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

using namespace std;

double EPS = 1e-9;

int gcd(int a, int b) { return b != 0 ? gcd(b, a%b) : a; }

int main() {
	double a, b, c, d, e, f;
	
	while (cin >> a >> b >> c >> d >> e >> f) {
		double x, y;
		
		int div1 = gcd(a, b), div2 = gcd(b, d);
		int div = gcd(div1, div2);
		a /= div; b /= div; c /= div;
		
		div1 = gcd(d, e); div2 = gcd(e, f);
		div = gcd(div1, div2);
		d /= div; e /= div; f /= div;
		
		y = (c - a*f/d)/(b - a*e/d);
		if (fabs(y) < EPS) y = 0.0;
		
		x = (c - b*y)/a;
		if (fabs(x) < EPS) x = 0.0;
		
		printf("%.3lf %.3lf\n", x, y);
	}
	
	return 0;
}

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

using namespace std;

const double EPS = 1e-6;

int main() {
	double a, b, c, d, e, f;
	while(cin >> a >> b >> c >> d >> e >> f) {
		double det = a * e - d * b;
		double x = (c * e - b * f) / det, y = (a * f - d * c) / det;
		x = round(x * 1000) / 1000;
		y = round(y * 1000) / 1000;
		if(signbit(x) && abs(x - 0) < EPS) x *= -1;
		if(signbit(y) && abs(y - 0) < EPS) y *= -1;
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
	return 0;
}

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<double> a, b, c, d, e, f;
    int i = 0;
    while(cin) {
        double ai, bi, ci, di, ei, fi;
        cin >> ai >> bi >> ci >> di >> ei >> fi;
        a.push_back(ai);
        b.push_back(bi);
        c.push_back(ci);
        d.push_back(di);
        e.push_back(ei);
        f.push_back(fi);
        i++;
    }
    
    for(int j=0; j+1<i; j++) {
        double ai = a[j];
        double bi = b[j];
        double ci = c[j];
        double di = d[j];
        double ei = e[j];
        double fi = f[j];
        
        double x = (bi * fi / ei + 0.0 - ci) / ( bi * di / ei + 0.0 - ai);
        double y = (ci - ai * x) / bi;
        if(x == -0) x = 0;
        if(y == -0) y = 0;
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
    return 0;
}