Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		s := strings.Split(sc.Text(), " ")
		a, _ := strconv.ParseFloat(s[0], 64)
		b, _ := strconv.ParseFloat(s[1], 64)
		c, _ := strconv.ParseFloat(s[2], 64)
		d, _ := strconv.ParseFloat(s[3], 64)
		e, _ := strconv.ParseFloat(s[4], 64)
		f, _ := strconv.ParseFloat(s[5], 64)
		x := ((b * f) - (c * e)) / ((b * d) - (a * e))
		y := ((a * f) - (c * d)) / ((a * e) - (b * d))
		if x == 0 {
			fmt.Printf("0.000 %.3f\n", y)
		} else if y == 0 {
			fmt.Printf("%.3f 0.000\n", x)
		} else {
			fmt.Printf("%.3f %.3f\n", x, y)
		}
	}
}

C++: #include <cstdio>

using namespace std;

int main() {
	while(true) {
		int a,b,c,d,e,f;
		if(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)<6)break;
		// adx + bdy = cd
		// adx + aey = af
		// (bd-ae)y = cd-af
		int y = (c*d-a*f)*2000/(b*d-a*e);
		// aex + bey = ce
		// bdx + bey = bf
		// (ae-bd)x = ce-bf
		int x = (c*e-b*f)*2000/(a*e-b*d);
		if(x >= 0) {
			x = (x+1)/2;
			printf("%d.%03d ",x/1000, x%1000);
		} else {
			x = (-x+1)/2;
			printf("-%d.%03d ",x/1000, x%1000);
		}
		if(y >= 0) {
			y = (y+1)/2;
			printf("%d.%03d\n",y/1000, y%1000);
		} else {
			y = (-y+1)/2;
			printf("-%d.%03d\n",y/1000, y%1000);
		}
	}
	return 0;
}

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

using namespace std;

double round(double d){
	int k = (int)(d*10000)%10;
	return (k>=5)? d-((double)k/10000)+0.001: d- ((double)k/10000);
}

int main(){
	int a, b, c, d, e, f;
	while(cin >> a >> b >> c >> d >> e >> f){
		double del = 1.0/(a*e - d*b);
		printf("%0.3f %0.3f\n", round(del*(e*c-b*f)), round(del*(a*f-d*c)));
	}
}

C++: #include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
using namespace std;
#define j bai;
int main() {
	double a, b, c, d, e, y, x, f, bai;
	bool bo = false;
	while (cin >> a >> b >> c >> d >> e >> f) {
		if (a ==0 || b ==0) {
			if (a) {
				y = c / b;
				x = f / d - e*y;
			}
			else if (b) {
				x = a / c;
				y = f / e - d*x;
			}
			bo = true;
		}
		else if (d == 0 || e == 0) {
			if (d) {
				y = f / e;
				x = c / a - d*y;
			}
			else if (e) {
				x = f / d;
				y = f / e - d*x;
			}
			bo = true;
		}
		
		else if (a < d) {
			bai = d / a;
			a *= j;
			b *= j;
			c *= j;
		}
		else {
			bai = a / d;
			d *= j;
			e *= j;
			f *= j;
		}
		if (((a > 0 && d < 0) || (a < 0 && d>0)) && bo==false) {
			y = (c + f) / (b + e);
			x = (c - b*y) / a;
		}
		else if (bo == false) {
			y = (c - f) / (b - e);
			x = (c - b*y) / a;
		}
		if (x == -0.000) {
			x = abs(x);
		}
		if (y == -0.000) {
			y = abs(y);
		}
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

C++: require("fs").readFileSync("/dev/stdin","utf8").trim().split('\n').map(function(z){i=z.split(' ');console.log(x=((i[2]*i[4]-i[1]*i[5])/(i[0]*i[4]-i[1]*i[3])).toFixed(3),((i[2]-i[0]*x)/i[1]).toFixed(3))})

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

int main()
{
    int a1, b1, c1, a2, b2, c2, d, dx, dy;
    while(cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2){
        d = a1*b2 - a2*b1;
        dx = c1*b2 - c2*b1;
        dy = a1*c2 - a2*c1;
        if(d != 0){
            cout <<fixed << setprecision(3)<< (float)dx/d<<' '<<(float)dy/d<<endl;
        }
    }
    return 0;
}

C++: #include<stdio.h>
int main()
{
	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=(e*c-b*f)/(e*a-b*d);
		y=(c-a*x)/b;
		if(x==-0)
			x=0;
		if(y==-0)
			y=0;
		printf("%0.3f %0.3f\n",x,y);
	}
}

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

using namespace std;

int main() {

	double no[12] = { 0 }, ans[4] = { 0 };
	int i, j = 0;

	for (i = 0; i < 12; i++) {
		cin >> no[i];
	}

	for (i = 0; i < 3; i=i+2) {
		ans[i] = (no[j + 2] * no[j + 4] - no[j + 1] * no[j + 5]) / (no[j] * no[j + 4] - no[j + 1] * no[j + 3]);
		ans[i + 1] = (no[j + 3] * no[j + 2] - no[j] * no[j + 5]) / (no[j + 1] * no[j + 3] - no[j] * no[j + 4]);
			j = j + 6;
	}

	for (i = 0; i < 3; i = i + 2) {
		if (ans[i] == 0)
			ans[i] = 0;
		if (ans[i + 1] == 0)
			ans[i + 1] = 0;
		printf("%.3f %.3f\n", ans[i], ans[i + 1]);
	}

	return 0;
}

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

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int main(){
	double a,b,c,d,e,f,a1;
	while(cin>>a>>b>>c>>d>>e>>f){
/*		a1=a;
		a=a*d;
		b=b*d;
		c=c*d;
		d=d*a1;
		e=e*a1;
		f=f*a1;
		y=(c-f)/(b-e);
		x=(f-e*y)/d;*/
		double det = a*e - b * d;
        double x = 1 / det * (c * e - b * f);
        double y = 1 / det * (f * a - c * d);
		if(x<0.001&&x>=0) x=0;
		if(y<0.001&&y>=0) y=0;
		if(x<-0.001) x=0;
		if(y<-0.001) y=0;
		printf("%.3lf %.3lf\n",x,y);
	}
}

C++: #include <stdio.h>
int main(){
	float a = 0,b = 0,c = 0,d = 0,e = 0,f = 0;
	float x = 0,y = 0;

	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f) != EOF){
		b *= d / a;
		c *= d / a;
		a *= d / a;
		if((c - f) == 0){
			y = 0;
		}
		else{
			y = (c - f) / (b - e);
		}
		
		if((c - b * y) == 0){
			x = 0;
		}
		else{
			x = (c - b * y) / a;
		}

		printf("%0.3f %0.3f\n",x,y);

	}

	return 0;
}

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

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

	return 0;
}

C++: #include <iomanip>
#include <iostream>
#include <vector>
#define N 2
 
using namespace std;
typedef vector< vector<double> > Equation;
 
bool input(Equation& c)
{
	if (!cin) return false;

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N + 1; ++j)
            cin >> c[i][j];
 
    return true;
}
 
int main()
{ 
    Equation c(N, vector<double>(N + 1));
	while (input(c))
	{
		// Gaussian elimination
		// 1. Forward elimination
        for (int i = 0; i < N - 1; ++i)
            for (int j = i + 1; j < N; ++j)
            {
                double d = c[j][i] / c[i][i];
                for (int k = i + 1; k <= N; ++k)
                    c[j][k] -= c[i][k] * d;
            }
 
		// 2. Back substitution
        for (int i = N - 1; i >= 0; --i)
        {
            double d = c[i][N];
            for (int j = i + 1; j < N; ++j)
                d -= c[i][j] * c[j][N];
            c[i][N] = d / c[i][i];
        }
 
        cout << setprecision(4) << fixed << c[0][N];
        for (int i = 1; i < N; ++i)
            cout << " " << c[i][N];
        cout << endl;
    }
 
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<complex>
#include<iomanip>
using namespace std;
int main(){
	double a,b,c,d,e,f,x,y;
	int t=90000;
	for(int i=t;i;i--){
		for(int j=i;j;j--){
			if(i+j==2)a=0.0;
		}
	}
	while(cin>>a){cin>>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;
		cout<<fixed<<setprecision(3)<<x<<" ";
		cout<<fixed<<setprecision(3)<<y<<endl;
	}
	return 0;
}