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<cstdio>
using namespace std;

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 = (c*e-b*f)/(a*e-b*d);
		y = (c-a*x)/b;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

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

using namespace std;

struct xy {
    double x;
    double y;
};

// solve:
// ax + by = c
// dx + ey = f
// a != 0
xy solve(double a, double b, double c, double d, double e, double f){
    xy result;
    // get y
    if (d == 0){
        result.y = f / e; // e!=0 to have an answer
    } else {
        // dx + (d/a)by = (d/a)c, dx + ey = f
        // (d/a-e)y = (d/a)c - f
        result.y = ((d/a)*c-f)/((d/a)*b-e);
    }
    result.x = (c-b*result.y) / a;
    return result;
}

int main(){
    //ifstream cin("input.txt");
    string line;
    while(getline(cin,line)){
        stringstream ss_line(line);        
        // input equation data
        double a,b,c,d,e,f;
        ss_line >> a >> b >> c >> d >> e >> f;
        // solve the equation
        xy result;
        if (a != 0)
            result = solve(a,b,c,d,e,f);
        else    // d != 0 since the equation has an answer 
            result = solve(d,e,f,a,b,c);
        cout << fixed << setprecision(3) << result.x << " " << result.y << endl;
    }

    return 0;
}

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

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

    cout << fixed << setprecision(3) << x << " " << y << 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){
		if(a<0){
			a=-a;
			b=-b;
			c=-c;
		}
		if(d<0){
			d=-d;
			e=-e;
			f=-f;
		}
		y=((c*d)-(a*f))/((b*d)-(a*e));
		x=((c*e)-(b*f))/((a*e)-(b*d));
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
double a,b,c,d,e,f,x,y;
cin>>a>>b>>c>>d>>e>>f;
y=(c*d-f*a)/(b*d-e*a);
x=(c-b*y)/a;
if(x==0)x=0;
if(y==0)y=0;
cout<<x<<" "<<y<<endl;
}

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

using namespace std;

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


double x(double, double, double, double, double, double) {

	return (c*e - b*f) / (a*e - b*d);
}

double y(double, double, double, double, double, double) {

	return (a*f - c*d) / (a*e - b*d);
}

double round(double dat, int keta ){

	int fct;
	fct = (int)pow(10, keta - 1);
	dat *= fct;
	dat += (dat < 0) ? -0.5 : 0.5;
	dat = (int)(dat);
	dat /= fct;
	return dat;
}

int main()
{
	double x1, x2, y1, y2;
	cin >> a >> b >> c >> d >> e >> f;

	x1 = x(a, b, c, d, e, f);
	y1 = y(a, b, c, d, e, f);

	cin >> a >> b >> c >> d >> e >> f;

	x2 = x(a, b, c, d, e, f);
	y2 = y(a, b, c, d, e, f);

	cout << fixed << setprecision(3) << round(x1,3) << " " << round(y1,3) << endl;
	cout << fixed << setprecision(3) << round(x2,3) << " " << round(y2,3) << endl;

	return 0;
}

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



  return 0;
}

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

typedef vector<
typedef pair<int,int> mat;
using namespace std;
int main()
{
int a,b,c,d,e,f;
double A[2][2];
double B[2];
double inv_A[2][2];
scanf("%d %d %d %d %d %d",a&,&b,&c,&d,&e,&f);
int det = a*e-b*d;
A[0][0]=a; A[0][1] = b;
A[1][0]=d; A[1][1] = e;
B[0] = c;
B[1] = f; 

inv_A[0][0]=1.0/(double)det *A[1][1]; inv_A[0][1]=1.0/(double)det *-A[1][1];
inv_A[1][0]=1.0/(double)det *-A[1][0]; inv_A[1][1]=1.0/(double)det *A[0][0];

double res[2];
res[0]=0;
res[1]=0;

for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
for(int k=0;k<2;k++){
res[i]+=inv_A[j][k]*B[k];
}
}
}

printf("%.3f %.3f\n",res[0],res[1]);
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
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<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 <iostream>
#include <cstdio>
int main(){
double a,b,c,d,e,f,x,y;
while(std::cin>>a>>b>>c>>d>>e>>f){
x=(b*f-c*e)/(b*d-a*e);
y=(f*a-d*c)/(a*e-b*d);
printf("%.3f %.3f\n",x==-0?0:x, y==-0?0:y);
}
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	double x,y,a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f){
		x=(c-(b*f/e))/(a-(b*d/e));
		y=(c-a*x)/b;
		cout<<fixed<<setprecision(3)<<x<<endl;
		cout<<fixed<<setprecision(3)<<y<<endl;
	}
	return 0;
}

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

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];
		if(!cin)
			break;
		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<cstdio>
#include<iostream>
using namespace std;

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