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 <cstdio>
#include <cmath>

using namespace std;

int main (int argc, char const* argv[])
{
    double a,b,c,d,e,f;
    double x,y;
    
    while(cin >> a >> b >> c >> d >> e >> f){
        if(!a && !b && !c && !d && !e && !f){
            x = (c*e - b*f) / (a*e - b*d);
            y = (c - a*x)/b;
        }

        if(!a){
            y = c/b;
            x = !e ? x = f/d : (f - e*y)/d;
        }

        if(!b){
            x = c/a;
            y = !d ? f/e : (f - d*x)/e;
        }

        if(!d){
            y = f/e;
            x = !b ? c/a : (c-e*y)/a;
        }

        if(!e){
            x = f/x;
            y = !a ? c/b : (c-a*x)/b;
        }

        x = round(x * 1000)/1000.0;
        y = round(y * 1000)/1000.0;
        
        printf("%.03lf %.03lf\n",x,y);
    }
    
    return 0;
}

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

using namespace std;

int main(){
	int a,b,c,d,e,f;
	float x , y , delta;

	while(cin >> a >> b >> c >> d >> e >> f){
			delta = (a * e) - (b * d);

			x = ((c * e) - (b * f)) / delta;
			y = ((a * f) - (c * d)) / delta;

			if(x / 10000 >= 5){
				x += 0.001;
			}if(y / 10000 >= 5){
				y += 0.001;
			}

		printf("%f %f\n", x , y);
	}
	
	return 0;
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

double a[6];

void solve(){
	printf("%.3f %.3f\n",(a[2]*a[4]-a[1]*a[5])/(a[0]*a[4]-a[1]*a[3]),(a[0]*a[5]-a[2]*a[3])/(a[0]*a[4]-a[1]*a[3]));
}

int main(){
	while(cin>>a[0]){
		rep(i,5)cin>>a[i+1];
		solve();
	}
	
	return 0;
}

C++: #include <stdio.h>

int main() {
	
	double a, b, c, d, e, f;	//scanf
	double x, y;							//ans
	int t, t2;
	
	double n = 0, m = 0, j = 0, h = 0, i = 0;						//temp
	
	while(1){
		
		if (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == EOF) break;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\n", a, b, c, d, e, f);	//input
		
		n = a / d;                                             //Xツづーツ堕オツつヲツつスツつ「
		j = d * n; h = e * n; i = f * n;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\t\t%lf\n", a, b, c, j, h, i, n);
		
		m = b - h;
		y = c - i;
		//printf("%lf %lf\n", m, y);
		
		if(y != 0) y /= m;
		//printf("%lf\n", y);
		
		i = c - (b * y);
		x = i / a;
		
		//printf("x = %lf, y = %lf\n", x, y);
		
		if (x > 0) { x += 0.0005; } else { x -= 0.0005; }
		if (y > 0) { y += 0.0005; } else { y -= 0.0005; }
		
		
		//printf("x = %lf, y = %lf\n", x, y);
		
		x *= 1000;
		y *= 1000;
		
		t = (int)x;
		t2 = (int)y;
		
		//printf("x = %lf, y = %lf t = %d, t2 = %d\n", x, y, t, t2);
		
		x = t;
		y = t2;
		
		x /= 1000;
		y /= 1000;
		
		//printf("%lf %lf\n", x, y);
		printf("%.3lf %.3lf\n", x, y);
		//2 -1 -3 1 -1 -3
		//2 -1 -3 -9 9 27

	}
	return 0;
}

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

int main(){
    double a[3],b[3];
    double x=0,y=0;
    while(cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2]){
        x = (b[1]*a[2] - a[1]*b[2])/(a[0]*b[1] - a[1]*b[0]);
        y = (a[0]*b[2] - a[2]*b[0])/(a[0]*b[1] - a[1]*b[0]);
        cout << fixed << setprecision(4) <<  x << " " << y << endl;
    }
}

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

int main(){
  double a,b,c,d,e,f;
  while(cin >> a >> b >> c >> d >> e >> f){
    double x,y;
    if(0 != a * e - d * b){
      x = (e * c - b * f)  / (a * e - b * d);
      y = (a * f - d * c)  / (a * e - b * d);
    }else{
      x = 0;
      y = 0;
    }
    double x_ = round(x * 1000)/1000;
    double y_ = round(y * 1000)/1000;
    if(x_ > -0.001 && x_ < 0.001) { x_ = 0; }
    if(y_ > -0.001 && y_ < 0.001) { y_ = 0; }
    cout << fixed << setprecision(3) << x_ << " ";
    cout << fixed << setprecision(3) << y_ << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

string float_to_string(float f, int digits)
{
  ostringstream oss;
  oss << setprecision(digits) << setiosflags(ios::fixed) << f;
  return oss.str();
}

int main(int argc, char const* argv[])
{
  int c[6];
  for (int i = 0; i < 6; i++) {
    c[i] = atoi(argv[i+1]);
  }

  float x = (float)(c[1]*c[5]-c[2]*c[4])/(c[1]*c[3]-c[0]*c[4]);
  float y = (float)(c[0]*c[5]-c[2]*c[3])/(c[0]*c[4]-c[1]*c[3]);

  cout << float_to_string(x, 3) << " " << float_to_string(y, 3) << endl;
  return 0;
}

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

#define EPS 1e-12;

int main(void){
  double a,b,c,d,e,f;
  double 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=(d*c-a*f)/(b*d-a*e);
    if(abs(x) < EPS) x = 0.000;
    if(abs(y) < EPS) y = 0.000;
    printf("%.3lf %.3lf\n",x,y);
  
  }
  
  return 0;
}

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

int main(){
  double a, b, c, d, e, f, x, y;
  while(true){
    cin >> a >> b >> c >> d >> e >> f;
    x = (e*c-b*f)/(e*a-b*d);
    y = (d*c-a*f)/(d*b-a*e);
    cout << setprecision(4) << x << " " << y << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
double r(double x,int n){
  for(int i=0;i<n;i++) x *= 10;
  x = floor(x+0.5);
  for(int i=0;i<n;i++) x /= 10;
  return x;
}
using namespace std;
int main(){
  double a,b,c,d,e,f,x,y,hy,dk;
  int n;
  while(cin>>a>>b>>c>>d>>e>>f){
    a *= d;
    b *= d;
    c *= d;//方程式にd倍
    dk = d;
    d *= (a/dk);
    e *= (a/dk);
    f *= (a/dk);//方程式にa倍
    y = (c-f)/(b-e);
    a /= d;
    b /= d;
    c /= d;//元の方程式
    hy = y * b;
    x = (c-hy)/a;
    cout << fixed << setprecision(3) << r(x,3) << ' ' << r(y,4) << endl;
  }
  return 0;
}