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 <iostream>
#include <iomanip>
using namespace std;

void OutputSolution(int a, int b, int c, int d, int e, int f)
{
    long double x, y;
	if(b == 0){
		x = c / a;
		y = (f-d*x) / e;
	}else{
		int B = b;
		a *= e;
		b *= e;
		c *= e;
		d *= B;
		e *= B;
		f *= B;
		x = (c-f) / (a-d);
		y = (c-a*x) / b;
	}
	cout << fixed << setprecision(3) << x << ' ' << y << endl;
}

int main()
{
	while(true){
		int a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		if(cin.eof()) break;
		OutputSolution(a, b, c, d, e, f);
	}
	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

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

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

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

  cout << fixed << setprecision(3) << x << " " << y << endl;
    
    
    
  return 0;

}

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

double halfadjust(double x){
	int tmp = (x*10000);
	tmp = tmp%10;
	double ans = static_cast<double>(static_cast<int>(x*1000));
	ans = ans/1000;
	if(tmp >= 5)
		ans += 0.001;
	if(tmp <= -5)
		ans -= 0.001;
	return ans;
}

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

void solve(){
	using namespace std;
	double x = (c*e-b*f)/(a*e-b*d);
	double y = (c*d-a*f)/(b*d-a*e);
	cout << setprecision(3) << fixed << halfadjust(x) << ' ';
	cout << halfadjust(y) << endl;
	cout << setprecision(6);
}

int main(){
	while(true){
		std::cin >> a >> b >> c >> d >> e >> f;
		if((!a&&!b)||(!d&&!e))
			break;
		solve();
	}
	return 0;
}

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

int main(void){

  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*d - a*f)/(b*d - a*e);

    if(x == -0)
      x = 0;
    if(y == -0)
      y = 0;
    
    printf("%.3lf %.3lf\n",x,y);
  }
    
  return 0;

}

C++: #include<iostream>
#include<string.h>
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 <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){
		x= (double)((e*c-b*f)/(a*e-b*d));
		y= (double)((-d*c)+a*f)/(a*e-b*d);
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

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

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

    if(x == 0) x = 0;
    if(y == 0) y = 0;

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

  return 0;
}

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;
}