Go: package main

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

func main() {
        var a, b, c, d, e, f float64
        sc := bufio.NewScanner(os.Stdin)
        for sc.Scan() {
                fmt.Sscanf(sc.Text(), "%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)

                det := a*e - b*d
                x := (e*c - b*f) / det
                y := (a*f - c*d) / det
                if x == 0.0 {
                        x = math.Abs(x)
                }
                if y == 0.0 {
                        y = math.Abs(y)
                }
                fmt.Printf("%.3f %.3f\n", x, y)
        }
}

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

using namespace std;

/*
aX+bY=c
dX+eY=f
*/

void solve(int a, int b, int c, int d, int e, int f) {
	double x = (double)(f - (double)e*c/b) / (d - (double)e*a/b);
	double y = ((double)c - a*x) / b;
	printf("%4.3f %4.3f\n", x, y);
}

int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		solve(a,b,c,d,e,f);
	}
	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){
    x = (a*f - c*d)/(a*e - d*b);
    y = (c -b*y)/a;
    printf("%.3f %.3f",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) {
		x=(c*e-b*f)/(a*e-b*d);
		y=(a*f-c*d)/(a*e-b*d);
		printf("%.3f %.3f", x, y);
	}

	return 0;

}

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

typedef pair<double,double> P;

P solve(double a, double b, double p, double c, double d, double q){
  P res;
  double tmp = a * d - b * c;
  res.first = (p * d - b * q) / tmp;
  res.second = (a * q - p * c) / tmp;
  return res;
}

double myRound(double x){
  int y = (int)round(x * 1000);
  return y / 1000.0;
}

int main(){
  double a, b, p, c, d, q;

  while(cin >> a >> b >> p >> c >> d >> q){
    double tmp = a * d - b * c;
    double x = (d * p - b * q) / tmp;
    double y = (a * q - c * p) / tmp;

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

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

struct Dataset{
	double a, b, c, d, e, f;
	double x, y;
	struct Dataset* next;
};

int main(){
	double a, b, c, d, e, f;
	struct Dataset *datalist, *p;

	datalist = (struct Dataset*)malloc(sizeof(struct Dataset));
	datalist->next = NULL;

	p = datalist;

	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		p->next = (struct Dataset*)malloc(sizeof(struct Dataset));
		p->next->next = NULL;
		p = p->next;
		p->a = a; p->b = b; p->c = c; p->d = d; p->e = e; p->f = f;
		if(a != 0){
			p->y = (a*f-c*d)/(a*e-b*d);
			p->x = c - b*p->y;
		}
		else{
			p->y = c/b;
			p->x = f/d - e*p->y/d;
		}
	}

	p = datalist;

	while(p->next != NULL){
		printf("%.3f %.3f\n", p->next->x, p->next->y);
		p = p->next;
	}

	return 0;
}

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

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

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

int main()
{
	int a,b,c,d,e,f;
	double 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);
		cout<<setprecision(3)<<fixed;
		cout<<x<<' '<<y<<endl;
	}
	return 0;
}

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

using namespace std;

double det(int a, int b, int c, int d) {
  return a * d - b * c;
}

int main() {
  int a, b, c, d, e, f;
  while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) == 6) {
    double x = det(c, b, f, e) / det(a, b, d, e),
           y = det(a, c, d, f) / det(a, b, d, e);
    if (x <= 0.0 && x >= -0.0009) x = 0.0;
    if (y <= 0.0 && y >= -0.0009) y = 0.0;
    printf("%.3f %.3f\n", x, y);
  }
  return 0;
}

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 round3(double dat){

	int fct;
	fct = (int)pow(10, 3);
	dat *= fct;
	dat = round(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) << round3(x1) << " " << round3(y1) << endl;
	cout << fixed << setprecision(3) << round3(x2) << " " << round3(y2) << endl;

	return 0;
}

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

int gcd(int a,int b){
	if(a<b)b%=a;
	if(b==0)return a;
	int c=b;b=a%b;a=c;
	return gcd(a,b);
}

int lcm(int a,int b){
	int c=gcd(a,b);
	return c*(a/c)*(b/c);
}

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

C++: /* -*- coding:utf-8 -*- */

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(void)
{
  double a,b,c,d,e,f;


  while(cin >> a >> b >> c >> d >> e >> f, !cin.eof()) {
    cout << "\n";
    double x,y;
    x = (e*c-b*f)/(a*e-b*d);
    y = (-c*d+a*f)/(a*e-b*d);
    cout << x << ' ' << y << endl;
    cout << fixed << setprecision(3) << showpoint << ((fabs(x) == 0.) ? 0. : x) << ' ' << ((fabs(y) == 0.) ? 0. : y) << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
    double a, b, c, d, e, f;
    while(true) {
        cin >> a;
        if(cin.eof()) break;
        cin >> b >> c >> d >> e >> f;
        double det = a * e - b * d;
        if(det == 0.0) break;
        cout << fixed << setprecision(3);
        cout << ((e*c/det-b*f/det)) << " " << ((-d*c/det+a*f/det)) << endl;
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,l;
    double a,b,c,d,e,f;
    double sum,x,y,x1,x2,y2,y1;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF)
    {
       x1=(c*e)-(b*f);
       x2=(e*a)-(b*d);
       y1=(d*c)-(f*a);
        y2=(d*b)-(a*e);
       x=x1/x2;
       y=y1/y2;
       if(x==0)
       {
           x=0;
           printf("%.3lf %.3lf\n",x,y);
       }
       else
       {
             printf("%.3lf %.3lf\n",x,y);
       }
}
       return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	
	double a[6];

	for(int i=0; i<6; i++){
		cin >> a[i];
	}

	double x,y;

	y=(a[2]/a[0]-a[5]/a[3])/(a[1]/a[0]-a[4]/a[3]);

	x = a[2]/a[0] - a[1]/a[0] * y;

	cout << x << " " << y << endl;
	
	double diff = 0.5;

	x<0?(diff=-0.5):(diff=0.5);
	x = (int)(x*1000+diff);
	
	y<0?(diff=-0.5):(diff=0.5); 
	y = (int)(y*1000+diff); 
	

	x /= 1000;y/=1000;
	

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

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