Go: package main

import (
	"fmt"
)

func main() {
	for {
		var a, b, c, d, e, f float64
		i, _ := fmt.Scan(&a, &b, &c, &d, &e, &f)
		if i == 0 {
			break
		}

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

		fmt.Printf("%.3f %.3f\n", x, y)
	}
}

C++: import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNextInt()) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int c = scanner.nextInt();
            int d = scanner.nextInt();
            int e = scanner.nextInt();
            int f = scanner.nextInt();

            Equation equation_1 = new Equation(a, b, c);
            Equation equation_2 = new Equation(d, e, f);

            double[] solution = solve(equation_1, equation_2);

            System.out.printf("%.3f %.3f\n", solution[0], solution[1]);
        }
    }

    static double[] solve(Equation left, Equation right) {
        double determinant = left.a * right.b - right.a * left.b;
        double x = (right.b * left.c - left.b * right.c) / determinant;
        double y = (-right.a * left.c + left.a * right.c) / determinant;

        double[] result = { x, y };
        return result;
    }

}

// ax + by = c
class Equation {

    Equation(int a, int b, int c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public int a;
    public int b;
    public int c;

}

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)
	{
		x=(c*e-b*f)/(a*e-b*d);
		y=(a*f-c*d)/(a*e-b*d);
		cout<<fixed<<setprecision(3)<<x<<" "<<y<<endl;
	}
	return 0;
}

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

int main(){
  double a,b,c,d,e,f;
  while(cin>>a>>b>>c>>d>>e>>f){
    if(b*f-c*e!=0&&a*e-d*b!=0)printf("%.3f %.3f\n",(d*b-e*a)/(b*f-c*e),(a*f-d*c)/(a*e-d*b));
    if(b*f-c*e==0&&a*e-d*b==0)printf("0.000 0.000");
    if(b*f-c*e==0)printf("0.000 %.3f\n",(a*f-d*c)/(a*e-d*b));
    if(a*e-d*b==0)printf("%.3f 0.000\n",(d*b-e*a)/(b*f-c*e));
  }
  return 0;
}

C++: #include<stdio.h>
main(){
  double a,b,c,d,e,f;
  while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!="EOF"){
    printf("%f %f\n",(c*e-b*f)/(a*e-b*d),(a*f-c*d)/(a*e-b*d));
  }
}

C++: #include <iostream>

double det(double mat[2][2]) {
    double det = 0.0 ;
    det = mat[0][0]*mat[1][1] ;
    det -= mat[0][1]*mat[1][0] ;
    return det ;
}


double **inv(double (&mat)[2][2]) {
    
    double detNum = 1.0/det(mat) ;
    double dotMat[2][2] = {
        {  mat[1][1]*detNum, -mat[0][1]*detNum },
        { -mat[1][0]*detNum,  mat[0][0]*detNum }
    } ;
    
    double **p = (double **)malloc(sizeof(double *) * 2) ;
    for (int i=0; i<2; i++) {
        p[i] = (double *)malloc(sizeof(double) * 2) ;
        for (int j=0; j<2; j++) {
            p[i][j] = dotMat[i][j] ;
        }
    }
    return p;
    
}

double **dot(double (&mat1)[2][2], double (&mat2)[2][1]) {
    
    
    double mat3[2][1] ;
    
    for (int n=0; n<2; n++) {
        double sum = 0 ;
        for (int m=0; m<2; m++) {
            sum += mat1[n][m]*mat2[m][0] ;
        }
        mat3[n][0] = sum ;
    }
    
    
    
    double **p = (double **)malloc(sizeof(double *) * 2) ;
    for (int i=0; i<2; i++) {
        p[i] = (double *)malloc(sizeof(double)) ;
        p[i][0] = mat3[i][0] ;
    }
    return p;
}



int main(int argc, const char * argv[]) {
    double a, b, c, d, e, f ;
    while (1) {
        std::cin >> a >> b >> c >> d >> e >> f ;
        
        if (std::cin.fail()) break ;
        
        double A[2][2] = {
            { a, b },
            { d, e }
        } ;
        double P[2][1] = {
            { c },
            { f }
        } ;
        
        auto invAp = inv(A) ;
        double invA[2][2] ;
        for (int i=0; i<2; i++) {
            for (int j=0; j<2; j++) {
                invA[i][j] = invAp[i][j] ;
            }
        }
        
        
        auto X = dot(invA, P) ;
        
        printf("%.3f %.3f\n", X[0][0], X[1][0]) ;
        
        free(invAp) ;
        free(X) ;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <cstdlib>
using namespace std;

// 一行取って、一番初めのTを習得
template <class T> int streamvar(std::istream& in, T& var)
{
    string s;
    if (!in) {
        return 1;
    }
    getline(in, s);
    istringstream is(s);
    is >> var;
    if (is.fail()) 
        return 1;
    return 0;
}
// 一行取って、T vectorに格納する
template <class T> int streamvec(std::istream& in, std::vector<T> &v)
{
    v.clear();
    string s;

    if (!in) 
        return 1;
    getline(in, s);
    if (in.fail()) 
        return 1;
    istringstream is(s);
    while (1) {
        T tmp;
        is >> tmp;
        if (is.fail())
            break;
        v.push_back(tmp);
    }
    return 0;
}

#define EPS 1e-6
int main(void)
{
    vector<int> v;
    while (!streamvec(cin, v)) {
        double det = v[0] * v[4] - v[3] * v[1];
        double x = v[4] * v[2] - v[1] * v[5];
        double y = -v[3] * v[2] + v[0] * v[5];
        printf("%.3f %.3f\n", round(x/det*1000)/1000+EPS, round(y/det*1000)/1000+EPS);
    }
    return 0;
}

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

int main() {
	// your code goes here

  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(x == -0.0){
      x = 0.0;
    }
    if(y == 0.0){
      y = 0.0;
    }

    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;
	
	while (cin >> a >> b >> c  >> d >> e >> f){

	cout << fixed << setprecision(3) << ((c*e-b*f)/(a*e-b*d))  <<  ((a*f-c*d)/(a*e-b*d)) << endl;
	
	}

	return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(8);
    double a1, b1, c1, a2, b2, c2;
    while(cin>>a1>>b1>>c1>>a2>>b2>>c2){
        double m = a1*b2-a2*b1;
        double x=(c1*b2-c2*b1)/m, y=(a1*c2-a2*c1)/m;
        if(abs(x)<1e-9) x=0;
        if(abs(y)<1e-9) y=0;
        cout<<x<<' '<<y<<'\n';
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],det,i[2][2],x[2];
  while(cin >>m[0][0]>>m[0][1]>>x[0]>>m[1][0]>>m[1][1]>>x[1]){
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    i[0][0] = m[1][1]/det;
    i[0][1] = -m[0][1]/det;
    i[1][0] = -m[1][0]/det;
    i[1][1] = m[0][0]/det;
    printf("%.3lf %.3lf\n",i[0][0]*x[0]+i[0][1]*x[1],i[1][0]*x[0]+i[1][1]*x[1]);
  }
 return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
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-a*x)/b;
    printf("%.3f %.3f\n",x,y);
  }
  

}

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