Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		lcm := lcm(a, d)
		mulA := lcm / a
		mulD := lcm / d
		a *= mulA
		b *= mulA
		c *= mulA
		d *= mulD
		e *= mulD
		f *= mulD

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		y := float64(cF) / float64(bE)
		x := (float64(c) - (y * float64(b))) / float64(a)

		if x == 0 {
			fmt.Printf("%.3f ", 0.0)
		} else {
			fmt.Printf("%.3f ", x)
		}
		if y == 0 {
			fmt.Printf("%.3f\n", 0.0)
		} else {
			fmt.Printf("%.3f\n", y)
		}
	}
}

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

int main() {
  double a[2][2];
  double a_inv[2][2];
  double det;
  double b[2];
  double x[2];
  int tmp;
  while (1) {
    cin >> a[0][0] >> a[0][1] >> b[0];
    cin >> a[1][0] >> a[1][1] >> b[1];
    if (cin.eof()) break;

    det = a[0][0]*a[1][1] - a[0][1]*a[1][0];
    a_inv[0][0] = a[1][1]/det;
    a_inv[0][1] = -a[0][1]/det;
    a_inv[1][0] = -a[1][0]/det;
    a_inv[1][1] = a[0][0]/det;
    for (int i=0; i<2; i++) {
      x[i] = 0.0;
      for (int j=0; j<2; j++) {
        x[i] += a_inv[i][j]*b[j];
      }
      tmp = round(x[i]*1000);
      if (!tmp) x[i] = 0.0;
    }
    cout.setf(ios::fixed);
    cout.precision(3);
    cout << x[0] << " " << x[1] << endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(void){
    double a,b,c,d,e,f,A,x,y,X,Y,Z;
 
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
 
 
    Y=a*e-b*d,Z=f*a-c*d;
    y=Z/Y;
 
    x=(c-b*y)/a;
 
   printf("%.3lf %.3lf\n",x,y);
    }
 
    return 0;
}

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

int main(){
    float a,b,c,d,e,f;
    while(-1!=scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f)){
        b/=a;
        c/=a;
        e-=d*b;
        f-=d*c;
        f/=e;
        c-=b*f;

        printf("%.3f %.3f\n", c, f);
    }
    return 0;
}

C++: #include <math.h>
#include <stdio.h>

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

C++: #include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

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

C++: solve :: [Double] -> String
solve [a,b,c,d,e,f] = (shows ((c*e-b*f)/(a*e-b*d)) " ") ++ (show $ (a*f-c*d)/(a*e-b*d))

main = getContents >>= mapM_ putStrLn . map solve . map (map read . words) . lines

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
using namespace std;
  
int main()
{
    int a, b, c, d, e, f;
    cout << showpoint << setprecision(3);
    while (cin >> a >> b >> c >> d >> e >> f){
        double x = ((double)(b*f - c*e)) / (double)(b*d - a*e);
        double y = ((double)(c*d - a*f)) / (double)(b*d - a*e);
        printf(".3f .3f", &x, &y);
    }
    cout.flush();
}

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

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

C++: #include<iostream>
#include<iomanip>
#define x_Formula(a,b,c,d,e,f) (c-(b*f)/e)/(a-(b*d)/e);
#define y_Formula(x,a,b,c) (c-(a*x))/b;

using namespace std;

double x;
double y;

void serch()
{
	int xx,yy;
	xx=x*1000;
	yy=y*1000;
//	cout << xx << " " << yy << endl;
	if(xx>0)
		xx+=5;
	else
		xx-=5;
	if(yy>0)
		yy+=5;
	else
		yy-=5;
	x=xx/1000;
	y=yy/1000;
//	cout << xx << " " << yy << endl;

}
int main()
{
	double num[6];
	int i;
	
	for(;cin >> num[0];)
	{
		for(i=1;i<6;i++)
		{
			cin >> num[i];
		}
		
		if(num[0]!=0 && num[1]!=0 && num[3]!=0 && num[4]!=0)
		{
			x=x_Formula(num[0],num[1],num[2],num[3],num[4],num[5])
			y=y_Formula(x,num[0],num[1],num[2])
		}
		if(num[0]==0)
		{
			y=num[2]/num[1];
			x=(num[5]-num[4]*y)/num[3];
		}
		else if(num[1]==0)
		{
			x=num[2]/num[0];
			y=(num[5]-num[3]*x)/num[4];
		}
		else if(num[3]==0)
		{
			y=num[5]/num[4];
			x=(num[2]-num[1]*y)/num[0];
		}
		else if(num[4]==0)
		{
			x=num[5]/num[3];
			y=(num[2]-num[0]*x)/num[1];
		}
		
		cout << setprecision(3);
		cout << setiosflags(ios::scientific);
		cout << fixed ;
		serch();
		cout << x << " " << y << endl;
	}
}

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


int main() {
	ios::sync_with_stdio(false);
	double a, b, c, d, e, f;
	
	cin >> a >> b >> c >> d >> e >> f;
	double x = (e*c-b*f)/(a*e-b*d);
	double y = (-c*d+a*f)/(a*e-b*d);
	cout << fixed << setprecision(3) << x << " " << y;
	
	while(cin >> a >> b >> c >> d >> e >> f){
		cout << "\n";
		double x = (e*c-b*f)/(a*e-b*d);
		double y = (-c*d+a*f)/(a*e-b*d);
		cout << fixed << setprecision(3) << x << " " << y;
	}

}

C++: #include<stdio.h>
#include<math.h>
double sg(double x){
	if ( x > 0.0 ) {
		return (0.001*(floor(x + 0.0005)))*1000;
	}else if(x==0.0){
		return x;
	} else {
    	return (-0.001 * floor(fabs(x) + 0.0005))*1000;
	}
}
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){
		y=sg(((c*d)-(a*f))/((b*d)-(a*e)));
		x=sg(((c*e)-(b*f))/((a*e)-(b*d)));
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
void calc(double x1, double y1, double a, double x2, double y2, double b)
{
	double d1 = x2;
	double d2 = x1;
	double xx1 = d1 * x1;
	double xy1 = d1 * y1;
	double a1 = d1 * a;
	double xx2 = d2 * x2;
	double xy2 = d2 * y2;
	double b1 = d2 * b;
	double y = xy1 - xy2;
	double c = a1 - b1;
	y = c / y;


	d1 = y2;
	d2 = y1;
	xx1 = d1 * x1;
	xy1 = d1 * y1;
	a1 = d1 * a;
	xx2 = d2 * x2;
	xy2 = d2 * y2;
	b1 = d2 * b;
	double x = xx1 - xx2;
	c = a1 - b1;
	x = c / x;
	if (x == 0)
	{
		x = 0;
	}
	if (y == 0)
	{
		y = 0;
	}
	printf("%.3lf %.3lf\n", x, y);
}
int main()
{
	double x1, y1, a, x2, y2, b;

	while(true)
	{
		cin >> x1 >> y1 >> a >> x2 >> y2 >> b;
		if (x1 == NULL)
		{
			break;
		}
		calc(x1, y1, a, x2, y2, b);
	}

		
	return 0;
}