Go: package main

import "fmt"

func main() {
	var resultX, resultY [100]float32
	var count int
	for {
		var a, b, c, d, e, f, x, y float32
		fmt.Scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)
		if a == 0 {
			break
		}
		//Simultaneous equation
		y = (((a * f) - (d * c)) / ((a * e) - (b * d)))
		x = ((c - (b * y)) / a)
		resultX[count] = x
		resultY[count] = y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%.3f %.3f\n", resultX[i], resultY[i])
	}
}

C++: #include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
using vec = vector<double>;
using mat = vector<vec>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check
const ll INF = 1LL << 60;
const double EPS = 1E-8;
//* Solve Ax = b. A is a square matrix in O(n^3)
//* Return 0-length vector if unsolvable/not-unique
//* partial pivoting
vec GaussJordan(const mat &A, const vec &b){
    ll n = A.size();
    mat B(n, vec(n+1)); //* last columb for solution
    //* initialize B
    REP(i, n) REP(j, n) B[i][j] = A[i][j];
    REP(i, n) B[i][n] = b[i];

    REP(i, n){
        ll pivot = i;
        for(ll j = i; j < n; j++){
            if(abs(B[j][i]) > abs(B[pivot][i])) pivot = j;
        }
        swap(B[i], B[pivot]); //* swap i-th row and pivot-th row
        if(abs(B[i][i]) < EPS) return vec();

        for(ll j = i+1; j <=n; j++) B[i][j] /= B[i][i];
        //* eliminition
        for(ll j = 0; j < n; j++){
            if(i != j){
                for(ll k = i+1; k <= n; k++) B[j][k] -= B[j][i] * B[i][k];
            }
        }
    }
    //* prepare solution
    vec x(n);
    for(ll i=0; i < n; i++) x[i] = B[i][n];
    return x;
}

//! http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0004&lang=ja
int main(){
    mat A(2, vec(2));
    vec b(2);
    while(scanf("%lf %lf %lf %lf %lf %lf",&A[0][0],&A[0][1],&b[0],&A[1][0],&A[1][1],&b[1])!=EOF){
        vec x = GaussJordan(A, b);
        printf("%.3lf %.3lf\n",x[0],x[1]);
    }
    return 0;
}

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

struct vector2{
	float x, y;
	vector2() : x(0), y(0){}
	vector2(float x, float y) : x(x), y(y){}
};

struct sim_elem{
	float a, b, c, d, e, f;
	sim_elem() :a(0), b(0), c(0), d(0), e(0), f(0){}
	sim_elem(float a, float b, float c, float d, float e, float f) :a(0), b(0), c(0), d(0), e(0), f(0){}
};

//	a / d * d
//	ey - by = f - c
//	y / y = (f - c) / y

// ax = -by + c
// ax / a = -(by + c) / a

vector2 sim_equ(sim_elem elem){

	float dx = elem.a / elem.d * elem.d;
	float ey = elem.a / elem.d * elem.e;
	float f = elem.a / elem.d * elem.f;

	float y = ey - elem.b;
	float yr = f - elem.c;
	y = yr / y;

	float ax = -elem.b * y + elem.c;
	float x = ax / elem.a;

	return vector2(x, y);
}

//	sprintf
float placement4(float val){
	char ret[128];
	sprintf_s(ret, sizeof(ret), "%.3f", val);
	return (float)atof(ret);
}

int main(){

	sim_elem elem;
	while (1){
		cin >> elem.a >> elem.b >> elem.c >> elem.d >> elem.e >> elem.f;
		if (cin.eof())break;
		vector2 ret;
		ret = sim_equ(elem);
		printf("%.3f %.3f\n", placement4(ret.x) ,placement4(ret.y) );
	}

	return 0;
}

C++: #include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

// using matrix	?????????????????´??????
void func()
{
	double a, b, c, d, e, f;
	double x, y;

	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()){


		cout << fixed << setprecision(3);


		if ((a*e - d*b) == 0)
			x = 0.0, y = 0.0;
		else {
			x = (double)((e*c - b*f) / (a*e - d*b));
			y = (double)((-(d*c) + a*f) / (a*e - d*b));


			if (x == 0)
				x = 0.0;
			if (y == 0)
				y = 0.0;
		}
		cout << x << space << y << endl;


		cout << dec;
	}
}

C++: #include <cstdio>
using namespace std;
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;
        if (a * f != c * d && b * f == c * e) {
            x = 0;
            y = (double)c / b;
        }
        else if (a * f == c * d && b * f != c * e) {
            x = (double)c / a;
            y = 0;
        }
        else if (a * f == c * d && b * f == c * e) {
            x = 0;
            y = 0;
        }
        else {
            x = ((double)a*e-b*d)/(c*e-b*f);
            y = ((double)c*d-a*f)/(b*d-e*a);
        }
        printf("%.3f %.3f\n", x, y);
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

double se(double x){
    x*=10000.0;
    if((int)x%10>=5){
        x+=10.0;
    }
    x/=10000.0;
    
    return x;
}

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

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

typedef struct {
    double x;
    double y;
} xy;

int main()
{
    using namespace std;
    double a, b, c, d, e, f, x, y;
    vector<xy> results;
    cout.precision(3);
    cout << fixed << showpoint;
    while (cin >> a >> b >> c >> d >> e >> f) {
        double denom = (b*d - a*e);
        x = (b*f - c*e)/denom;
        y = (c*d - a*f)/denom;
        x = round(x*1000.0)/1000.0;
        y = round(y*1000.0)/1000.0;
        if (x == 0) x = fabs(x);
        if (y == 0) y = fabs(y);
        results.push_back( {x,y} );
    }
    for (vector<xy>::iterator itr = results.begin();
         itr != results.end(); ++itr) {
        cout << itr->x << " " << itr->y << endl;
    }
}

C++: #include <stdio.h>

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