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<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],det,inv[2][2],ans[2],x,y;
  while(cin >>m[0][0]>>m[1][0]>>ans[0]>>m[0][1]>>m[1][1]>>ans[1]){
    det = m[0][0]*m[1][1]-m[1][0]*m[0][1];
    inv[0][0] = m[1][1]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[1][1] = m[0][0]/det;
    x = inv[0][0]*ans[0]+inv[1][0]*ans[1];
    y = inv[0][1]*ans[0]+inv[1][1]*ans[1];
    printf("%.3lf %.3lf\n",x,y);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
 
auto main () -> int
{
    long double a , b , c , d , e , f;
    while (std::cin >> a >> b >> c >> d >> e >> f)
    {
        auto delta = a * e - b * d;
        auto x = (e * c - b * f) / delta;
        auto y = (- c * d + a * f) / delta;
        std::printf ("%.3Lf %.3Lf\n" , x , y);
    }
}

C++: #include<cstdio>
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	double x[500];
	double y[500];
	double a, b, c, d, e, f;
	int i = 0;
	do
	{
		cin >> a >> b >> c >> d >> e >> f;
		double sum_d = (a*e - b * d);
		y[i] = (a*f - c * d) / sum_d;
		x[i] = (c * e - b * f) / sum_d;
		++i;
	} while (cin.get() != EOF);
	--i;
	int j = 0;
	for (; j <= i; ++j)
	{
		if ((x[j] - 0) < 0.0001 && (x[j] - 0) > -0.0001)
		{
			x[j] = 0;
		}
		else if ((y[j] - 0) < 0.0001&& (y[j] - 0) > -0.0001)
		{
			y[j] = 0;
		}
		cout<< fixed << setprecision(3) << x[j] << " " << y[j]<<endl;
	}
}

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

int main(){
    double a, b, c, d, e, f;
    double x, y;
    while(cin >> a >> b >> c>>d>>e>>f){
        y = (a*f-d*c)/(a*e-b*d);
        x = (c-b*y)/a;
        printf("%3f %3f\n", x, y);
    }
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
	double a,b,c,d,e,f,x,y;
	while(cin>>a>>b>>c>>d>>e>>f){
		y = (d*c - a*f)/(d*b - a*e);
		x = (c-b*y)/a;
	printf("%0.3f %0.3f \n",x+0.00000001,y+0.00000001);
	}
}

C++: #include <stdio.h>

double dc4pi5(double arg,int n){
	int i = 0;
	for(i = 0;i < n;i++){
		arg *= 10;
	}
	int tmp = (int)arg;
	double ret = tmp;
	if(tmp % 10 <= 4){
		ret -= tmp % 10;
	}else{
		ret += 10 - tmp % 10;
	}
	for(i = 0;i < n;i++){
		ret /= 10;
	}
	return ret;
}

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

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

using namespace std;

int main() {

	double ans[4], coe[12];
	int i;

	for (i = 0; i < 12; i++) 
		cin >> coe[i];
	ans[0] = (coe[2] * coe[4] - coe[1] * coe[5]) / (coe[0] * coe[4] - coe[1] * coe[3]);
	ans[1] = (coe[2] * coe[3] - coe[0] * coe[5]) / (coe[1] * coe[3] - coe[0] * coe[4]);
	ans[2] = (coe[8] * coe[10] - coe[7] * coe[11]) / (coe[6] * coe[10] - coe[7] * coe[9]);
	ans[3] = (coe[8] * coe[9] - coe[6] * coe[11]) / (coe[7] * coe[9] - coe[6] * coe[10]);
	
	for (i = 0; i < 4; i++) {
		if (ans[i] == 0) {
			ans[i] = 0;
		}
	}

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

	return 0;

}

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

void solv(
	double a,
	double b,
	double c,
	double d,
	double e,
	double f,
	double & x,
	double & y){
	y = (f - (d*c)/a)/(e - (b*d)/a);
	x = (c - b*y)/a;
}

int main(){
	std::vector<std::pair<double, double>> ans;

	double a,b,c,d,e,f;
	std::pair<double, double> tmp;

	while(true){
		std::cin >> a >> b >> c >> d >> e >> f;
		if(std::cin.eof() == true) break;
		solv(a,b,c,d,e,f,
			tmp.first, tmp.second);
		ans.push_back(tmp);
	}

	for(auto && a : ans){
		printf("%0.3f %0.3f\n", a.first, a.second);
	}
}

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

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

	return 0;
}

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

double adjust(double d)
{
  if(-0.0005<=d && d<=0.0){
    return 0.0001;
  }else{
    return d;
  }
}

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

  return 0;
}

C++: #include <cmath>
#include <iomanip>
#include <ios>
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int main()
{
    string s;
    while (getline(cin, s)) {
        stringstream ss;
        ss << s;
        int a, b, c, d, e, f;
        ss >> a >> b >> c >> d >> e >> f;

        auto det = [](int a00, int a01, int a10, int a11) -> double {
            return a00 * a11 - a01 * a10;
        };

        auto x1 = det(c, b, f, e) / det(a, b, d, e);
        auto x2 = det(a, c, d, f) / det(a, b, d, e);
        if (x1 == 0) {
            x1 = 0;
        }
        if (x2 == 0) {
            x2 = 0;
        }
        cout << setprecision(4) << fixed << x1 << ' ' << x2 << endl;
    }
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
	double a[60000]={0};
	int i=0;
	while(cin>>a[i++]);
	int n=i-1;
	for(int j=0;j<n;j+=6){
		double x=0,y=0;
		if(a[j+3]!=0&&a[j]!=0){
			double k=a[j]/a[j+3];
			a[j+3]*=k,a[j+4]*=k,a[j+5]*=k;
			y=(a[j+2]-a[j+5])/(a[j+1]-a[j+4]);
			x=(a[j+2]-a[j+1]*y)/a[j];
		}else if(a[j]==0){
			y=a[j+2]/a[j+1];
			x=(a[j+5]-a[j+4]*y)/a[j+3];
		}else if(a[j+3]==0){
			y=a[j+5]/a[j+4];
			x=(a[j+2]-a[j+1]*y)/a[j];
		}
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

C++: 
#include<stdio.h>

int main (void){

    int num0[6];
    int num1[6];
    int i;
    double x0, y0;
    int x1, y1;

    for(i = 0;i < 6 ;i++){
        scanf("%d",&num0[i]);
    }

    for(i = 0; i < 3; i++){
        num1[i] = num0[i] * num0[3];
    }
    for(i = 3; i < 6; i++){
        num1[i] = num0[i] * num0[0];
    }

    y0 = (num1[2] - num1[5]) / (num1[1] - num1[4]);

    x0 = (num0[2] - num0[1] * y0) / num0[0];

    /*y1 = y0 * 1000;
    if(y1 % 10 >= 5){
        y1++;
        y0 = y1 / 1000;
    }

    x1 = x0 * 1000;
    if(x1 % 10 >= 5){
        x1++;
        x0 = x1 / 1000;
        printf("%f",x0);
    }*/

    printf("\t%.3f\n\t%.3f\n",x0 ,y0);


    return 0;
}

C++: #include <iostream>
#include <cstdio>
#define EPS 1e-10
using namespace std;

int main(){
    double a,b,c,d,e,f,x,y;
    while(cin >> a >> b >> c >> d >> e >> f){
        if(cin.eof()) break;
        x = (c*e-b*f)/(a*e-b*d);
        y = (f*a-c*d)/(a*e-d*b);
        printf("%.3f %.3f\n",x+EPS,y+EPS);
    }
}