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>

int main (int argc, char *argv[]) {
	using namespace std;
	int a, b, c, d, e, f;
	while (EOF != fscanf(stdin, "%d %d %d %d %d %d\n", &a, &b, &c, &d, &e, &f)) {
		float tmp1 = static_cast<float>(f)-(static_cast<float>(c)*static_cast<float>(d)/static_cast<float>(a));
		float tmp2 = static_cast<float>(e)-(static_cast<float>(b)*static_cast<float>(d)/static_cast<float>(a));
		float y = tmp1/tmp2;
		float x = (static_cast<float>(c) - static_cast<float>(b) * y) / static_cast<float>(a);
		printf("%f %f\n", x, y);		
		//printf("y=%f\n", (f-(c*d/a))/(e-(b*d/a)));
	}
	
	return 0;
}

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

using namespace std;

int main(){
 double x,y,a,b,c,d,e,f;
 while(cin>>a>>b>>c>>d>>e>>f){
  x=(c*e-f*b)/(a*e-d*b);
  y=(a*f-d*c)/(a*e-d*b);

  cout << fixed << setprecision(3) << x << " " << y << endl;
 }
 return 0;
}

C++: /*
    AOJ Volume0 0003

    Simultaneous Equation

    Write a program which solve a simultaneous equation:
        ax+by=c
        dx+ey=f

    The program should print x and y for given 
    a, b, c, d, e and f (-1,000 ≤ a,b,c,d,e,f ≤ 1,000).
    You can suppose that given equation has a unique solution.
    
    Input
        The input consists of several data sets, 1 line for each data set.
        In a data set, there will be a,b,c,d,e,f separated by a single space.
        The input terminates with EOF.

    Output
        For each data set, print x and y separated by a single space.
        Print the solution to three places of decimals. Round off the solution to three decimal places.

    Sample Input 1
        1 2 3 4 5 6
        2 -1 -2 -1 -1 -5

    Output for the Sample Input 1
        -1.000 2.000
        1.000 4.000

    Sample Input 2
        2 -1 -3 1 -1 -3
        2 -1 -3 -9 9 27

    Output for the Sample Input 2
        0.000 3.000
        0.000 3.000


*/

#include <iostream>
#include <iomanip>

int main(void)
{

    while(true)
    {
        double a,b,c,d,e,f;
        if(std::cin >> a >> b >> c >> d >> e >> f)
        {
            double rate = d / a; 
            double 
                a2 = a * rate,
                b2 = b * rate,
                c2 = c * rate;

            double
                d2 = d - a2,  // defintly 0
                e2 = e - b2,
                f2 = f - c2;

            double y = f2 / e2;
            double x = (c - b*y) / a;

            std::cout << std::setprecision(3) << std::fixed << x << " " << y << std::endl;
        }

        else break;
    }

    return 0;

}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
constexpr double eps = 1e-9;
int main() {
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f) {
        double x = (c*e - b*f) / (a*e - b*d);
        double y = (c - a*x) / b;
        if(fabs(x) < eps) x = 0;
        if(fabs(y) < eps) y = 0;
        cout << fixed << setprecision(3) << x << " " << y << endl;
    }
}

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	while(1){
		double a,b,c,d,e,f;
		std::cin>>a>>b>>c>>d>>e>>f;
		double b2=b*gcd(a,d)/a;
		double e2=e*gcd(a,d)/d;
		double c2=c*gcd(a,d)/a;
		double f2=f*gcd(a,d)/d;
		double y=(f2-c2)/(e2-b2);
		double x=(e-b*y)/a;
		std::cout<<x<<" "<<y<<std::endl;
		break;
	}
	return 0;
}

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

using namespace std;

/* ax + by = c
   dx + ey = f
   
   (x, y) = { (ce - bf) / (ae - bd), (af - cd) / (ae - bd) } */


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

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

	while (cin >> a >> b >> c >> d >> e >> f)
	{
		Equation2(a, b, c, d, e, f, x, y);

		cout << setprecision(3) << x << ' ' << y << endl;
	}

	return 0;
}

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




double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}


int main(){
    
	double ax, by, c, dx, ey, f;
    double x, y;
    double l, d1, d2;
        
	while(cin>> ax>> by>> c >> dx>> ey>> f){
        
        x = 0.0;
        y = 0.0;
        
        if(ax == dx){
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        else if (by == ey) {
            ax -= dx;
            x = (c-f) / ax;
            y = (f + dx*(-x)) / ey;
        }
        else{
            l = lcm(fabs(ax), fabs(dx));
            d1 = fabs(l / ax);
            d2 = fabs(l / dx);
            ax *= d1;
            by *= d1;
            c  *= d1;
            dx *= d2;
            ey *= d2;
            f  *= d2;
            
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
        }
        
        printf("%.3f %.3f\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(cin>>a>>b>>c>>d>>e>>f,!cin.eof())
	{
		
		y = b/e;
		x = (y*f-c)/(y*d-a);
		y = (c-a*x)/b;
		cout<<setiosflags(ios::fixed)<<setprecision(3);
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

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


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

C++: #include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_N 100
#define MAX_set 200

typedef long long int ll;
using namespace std;


int main(){

	double a, b, c, d, e, f;

	while(scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF){

		double x = (e*c-b*f)/(e*a-b*d);
		if(e*c == b*f)
			x = 0;
	
		printf("%.3f %.3f\n", x, (c-a*x)/b);
	
	
	
	}

}

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

int main(void) {
    int a, b, c, d, e, f;
    float x, y;
    float det;
    while(cin >> a >> b >> c >> d >> e >> f) {
        det = a * e - b * d;
        x = (float)(e * c - b * f) / det;
        y = (float)(-d * c + a * f) / det;
        x = roundf(1000 * x) / 1000.0;
        y = roundf(1000 * y) / 1000.0;
        if(x == -0)
            x = 0.0;
        if(y == -0)
            y = 0.0;
        printf("%.3f %.3f\n", x, y);
    }
}

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

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