Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func mathRound(f float64) float64 {
	return math.Floor(f + .5)
}

func round(x float64) float64 {
	if math.Abs(x) < 0.001 {
		return 0
	}
	return mathRound(x*1000) / 1000
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		a, err := nextFloat64()
		if err != nil {
			break
		}
		b, _ := nextFloat64()
		c, _ := nextFloat64()
		d, _ := nextFloat64()
		e, _ := nextFloat64()
		f, _ := nextFloat64()

		detA := a*e - b*d
		x := (c*e - b*f) / detA
		y := (a*f - c*d) / detA

		fmt.Printf("%.3f %.3f\n", round(x), round(y))
	}
}

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

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    const int TMP = 1000;
    for(;;){
        int a,b,c,d,e,f;
        if(!(cin >> a >> b >> c >> d >> e >> f))
            return 0;
        int x = 10 * TMP * (c*e - b*f) / (a*e - b*d);
        int y = 10 * TMP * (c*d - a*f) / (b*d - a*e);
        int xSign = (x>=0? 1:-1);
        int ySign = (y>=0? 1:-1);
        x = abs(x);
        y = abs(y);

        if(x % 10 >= 5)
            x += 10;
        x /= 10;
        if(xSign == -1 && x > 0)
            cout << '-';
        printf("%d.%03d ", x/TMP, x%TMP);

        if(y % 10 >= 5)
            y += 10;
        y /= 10;
        if(ySign == -1 && y > 0)
            cout << '-';
        printf("%d.%03d\n", y/TMP, y%TMP);
    }
}

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

using namespace std;

int main(){

	//FILE *fp;
	//if((fp=fopen("output.txt","w"))==NULL){
	//	return -1;
	//}

	int a,b,c,d,e,f;
	while(1){
		cin >> a >> b >> c >> d >> e >> f;
		if(cin.eof()){
			break;
		}
		double y = (double)(a*f-c*d)/(a*e-b*d);
		double x = (double)(c-b*y)/a;
		fprintf(stdout,"%.3f %.3f\n",x,y);
	}
//	fclose(fp);

	return 0;
}

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

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

	while(1){
		getline( cin, str );
		if( str.size()==0 ){
			break;
		}
		sscanf( str.c_str(), "%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f );

		double D  = a*e-b*d;
		double D1 = c*e-f*b;
		double D2 = a*f-d*c;

		if( D == 0.000 ){
			if( (a==0.0) && (d==0.0) ){
				x = 0.0;
				y = c/b;
			}
			if( (b==0.0) && (e==0.0) ){
				x = c/a;
				y = 0.0;
			}
		}
		else{
			x = D1 / D;
			y = D2 / D;
		}

		bool isX = ( (c-a*x)/b == (f-d*x)/e );
		bool isY = ( (c-b*y)/a == (f-e*y)/d );
		if( !isX && isY ){
			x = 0.0;
			y = c/b;
		}else if( isX && !isY ){
			y = 0.0;
			x = c/a;
		}else if( !isX && !isY ){
			x = y = 0.0;
		}

		if( x == -0.000 )	x = 0.000;
		if( y == -0.000 )	y = 0.000;

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

	return 0;
}

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

int main()
{
	for (double a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; cout << fixed << setprecision(4) << ((c*e - b*f) != 0 ? (c*e - b*f) / (a*e - b*d) : 0.0000) << ' ' << ((a*f - c*d) != 0 ? (a*f - c*d) / (a*e - b*d) : 0.0000) << endl);
	return 0;
}

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 || (b - e) == 0){
			y = 0;
		}
		else{
			y = (c - f) / (b - e);
		}
		
		if((c - b * y) == 0 || a == 0){
			x = 0;
		}
		else{
			x = (c - b * y) / a;
		}

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

	}

	return 0;
}

C++: #include<iostream>
int GCM(int a,int b){
	if(b==0)return a;
	return GCM(b,a%b);
}

int main(){
	int a,b,c,d,e,f;
	std::cout.precision(3);
	std::cout.setf(std::ios::fixed);
	while(std::cin>>a>>b>>c>>d>>e>>f){
		double x=0.0,y=0.0;
		double a_=a,b_=b,c_=c,d_=d,e_=e,f_=f;
		b_*=d,c_*=d;
		e_*=a,f_*=a;
		y=(c_-f_)/(b_-e_);
		x=(c-y*b)/a;
		std::cout<<x<<" "<<y<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
 int i;
 double a,b,c,d,e,f;
 vector<double> x,y;
 while(cin >> a >> b >> c >> d >> e >> f) {
	 if (a==0 && e==0) {y.push_back(c/b); x.push_back(f/d); continue; }
	 if (b==0 && d==0) {x.push_back(c/a); y.push_back(f/e); continue; }
	 if (d==0 || e==0) {swap(a,d); swap(b,e); swap(c,f); }
	 y.push_back((c-f*a/d)/(b-e*a/d));
	 x.push_back((c-f*b/e)/(a-d*b/e));
	 }
 for (i=0;i<x.size();i++) printf("%.3f %.3f\n",x[i],y[i]); 
 return 0;
}

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