Go: package main

import "fmt"

func main() {

	for {
		var a, b, c, d, e, f float64
		var x, y float64
		i, _ := fmt.Scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)
		if i != 6 {
			return
		}

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

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

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

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

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

		if (x <= 0.0001 && -0.0001 <= x) {
			x = 0;
		}
		if (y <= 0.0001 && -0.0001 <= y) {
			y = 0;
		}

		x *= 1000.0;
		round(x);
		x /= 1000.0;

		y *= 1000.0;
		round(y);
		y /= 1000.0;

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

	}
	return 0;
}

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

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

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

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

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

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

int main(){
    float a, b, c, d, e, f, x, y, dividedNum1, dividedNum2 = 0;
    while(cin >> a >> b >> c >> d >> e >> f){
        dividedNum1 = a;
        dividedNum2 = d;
        a *= dividedNum2;
        b *= dividedNum2;
        c *= dividedNum2;
        d *= dividedNum1;
        e *= dividedNum1;
        f *= dividedNum1;
        
        float temp1 = b - e;
        float temp2 = c - f;
        
        y = floor((temp2 / temp1) * 1000 + 0.0005) / 1000;
        x = floor((c - (b * y) ) * 1000 + 0.0005) / 1000;
        
        cout << fixed << setprecision(3) << x << " " << fixed << setprecision(3) << y << endl;
    }
    return 0;
}

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;
}