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++: #include<stdio.h>
int main(void){

	double a, b, c, d, e, f;
	double A,B;
	double x, y;

	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		 
	 
	 if ( (a > 0 && d <　0)|| (a > 0 && d > 0)) {
		A = c*d - f*a;
		B = b*d - e*a;
        y = A / B;
    }
    
    else if ((a <= 0 && d >= 0) || (a <= 0 && d <= 0)) {
		A = c*d + f*a;
		B = b*d + e*a;
        y = A / B;
    }


    x = (c - y * b) / a;
	printf("%.3f %.3f\n" ,x , y);
	}
	return 0;

}

C++: #include <stdio.h>

int main(){
    double a,b,c,d,e,f;
    double x,y;
    
    while (scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF) {
        x=(double)((c*e-b*f)/(a*e-b*d));
        y=(double)((c*d-a*f)/(b*d-a*e));
        if(a*e-b*d==0||b*d-a*e==0){
            return 1;
        }
        if(x==-0){
            x=0;
        }
        if(y==-0){
            y=0;
        }
        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);
    if(x==0) x=0 ;
    if(y==0) y=0;
    printf("%.3lf %.3lf\n",y,x);
  }
}

C++: #include <cstdio>

#define X 0
#define Y 1
#define C 2
#define SIKI1 0
#define SIKI2 1
#define LEFT  0
#define RIGHT 1

int main(){
	double A[3][3][3];
	double n[6];

	while ( scanf("%lf %lf %lf %lf %lf %lf",&n[0],&n[1],&n[2],&n[3],&n[4],&n[5]) != EOF ){
		//ÏÌú»
		for (int i=0 ; i<=RIGHT ; i++){
			for (int j=0 ; j<=SIKI2 ; j++){
				for (int k=0 ; k<=C ; k++){
					A[i][j][k] = 0;
				}
			}
		}

		//lÌãü
		A[LEFT][SIKI1][X]  = n[0];
		A[LEFT][SIKI1][Y]  = n[1];
		A[RIGHT][SIKI1][C] = n[2];
		A[LEFT][SIKI2][X]  = n[3];
		A[LEFT][SIKI2][Y]  = n[4];
		A[RIGHT][SIKI2][C] = n[5];

		//®PÌXð¶Ó©çEÓÖÚ·é
		A[ RIGHT ][ SIKI1 ][ X ]  += (-1.0)*(A[ LEFT ][ SIKI1 ][ X ]);
		A[ LEFT  ][ SIKI1 ][ X ]  = 0;

		//®PÌ¼ÓðYÌWÅé		
		A[ RIGHT ][ SIKI1 ][ X ]  /= A[ LEFT ][ SIKI1 ][ Y ];
		A[ RIGHT ][ SIKI1 ][ C ]  /= A[ LEFT ][ SIKI1 ][ Y ];
		A[ LEFT  ][ SIKI1 ][ Y ]  = 1;

		//®QÌYÉãüµÄ®Qð(ax = b)Ì`É·é
		int a = A[ LEFT ][ SIKI2 ][ Y ];
		A[ LEFT  ][ SIKI2 ][ X ]  += a * A[ RIGHT ][ SIKI1 ][ X ];
		A[ LEFT  ][ SIKI2 ][ Y ]   = 0;
		A[ RIGHT ][ SIKI2 ][ C ]  += a * A[ RIGHT ][ SIKI1 ][ C ] * (-1.0);
		//XYÌðªÜé
		double answerX = A[ RIGHT ][ SIKI2 ][ C ] / A[ LEFT ][ SIKI2 ][ X ];
		double answerY = (n[2] + n[0]*answerX*(-1.0))/n[1];
		
		//¬æSÊðlÌÜü·é
		if ( (((int)(answerX*10000))%10) >= 5){
			answerX += 0.001;
		}
		if ( (((int)(answerY*10000))%10) >= 5){
			answerY += 0.001;
		}
		if (answerX==-0.0){
			answerX = 0;
		}
		
		//ðÌoÍ
		printf("%.3f %.3f\n", answerX , answerY);
	}

	return 0;
}

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

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

	
	while (~scanf( "%d%d%d%d%d%d" ,&a,&b,&c,&d,&e,&f) )
	
	{
		double y=(double)(c*d-a*f)/(double)(b*d-a*e);
		if(a!=0)
		
		printf("%.3f %.3f\n",(c-b*y)/a,y);
		else
		printf("%.3f %.3f\n",(f-e*y)/d,y);
	}

    return 0;
    
        }

C++: #include <stdio.h>

int main(){
	int i,j;
	int a,b,c,d,e,f;
	int tmp;
	float x,y;
		
	while(scanf("%d %d %d %d %d %d\n",&a,&b,&c,&d,&e,&f)!=-1){
		tmp = d;
		d*=a; e*=a; f*=a;
		a*=tmp; b*=tmp; c*=tmp;
		y=(float)((c-f)/(b-e));
		x=(float)((c-b*y)/a);
		if(x==-0.000000){
			x = 0.000000;
		}
		if(y==-0.000000){
			y = 0.000000;
		}
		printf("%0.3f %0.3f\n",x,y);
	}
	
	
	return 0;
}

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

using namespace std;

void solve(int a, int b, int c, int d, int e, int f) {
	double???y=(a*f-c*d)/(a*e-b*d);;
	double???x=(c-b*y)/a;;
	
	print("%.3f %.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 <bits/stdc++.h>

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);
		if (-0.0005 <= x && x < 0.0005) x = 0;
		if (-0.0005 <= y && y < 0.0005) y = 0;
		// 数値を固定小数点形式で表示
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;

vector<vector<double> > A;
vector<double> B;

void gauss_jordan(){
    for(int i=0;i<A.size();i++){
        B[i] /= A[i][i];
        double aii = A[i][i];
        for(int j=i;j<A.size();j++)
            A[i][j] /= aii;
        for(int j=0;j<A.size();j++){
            if(j == i) continue;
            B[j] -= A[j][i] * B[i];
            double aji = A[j][i];
            for(int k=i;k<A.size();k++)
                A[j][k] -= aji * A[i][k];
        }
    }
}


int main(){
    double a[2][2] = {0}, b[2] = {0};
    while(scanf("%lf %lf %lf %lf %lf %lf", &a[0][0], &a[0][1], &b[0], &a[1][0], &a[1][1], &b[1]) != EOF){
        A.clear();
        B.clear();
        A.resize(2);
        for(int i=0;i<2;++i){
            for(int j=0;j<2;++j){
                A[i].push_back(a[i][j]);
            }
            B.push_back(b[i]);
        }
        gauss_jordan();
        printf("%.3f %.3f\n", B[0], B[1]);
    }

    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) {
    double det = a*e - b*d;
    double y = (-d*c+a*f)/det;
    double x = (c-b*y)/a;

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

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

using namespace std;

int main() {

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

	for (i = 0; i < 12; i++) 
		cin >> coe[i];
	ans[0] = double(coe[2] * coe[4] - coe[1] * coe[5]) / double(coe[0] * coe[4] - coe[1] * coe[3]);
	ans[1] = double(coe[2] * coe[3] - coe[0] * coe[5]) / double(coe[1] * coe[3] - coe[0] * coe[4]);
	ans[2] = double(coe[8] * coe[10] - coe[7] * coe[11]) / double(coe[6] * coe[10] - coe[7] * coe[9]);
	ans[3] = double(coe[8] * coe[9] - coe[6] * coe[11]) / double(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 <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

string float_to_string(float f, int digits)
{
  if (f == 0) {
    f = 0;
  }
  ostringstream oss;
  oss << setprecision(digits) << setiosflags(ios::fixed) << f;
  return oss.str();
}

void calc_and_output(int *c)
{
  float x = (float)(c[1]*c[5]-c[2]*c[4])/(c[1]*c[3]-c[0]*c[4]);
  float y = (float)(c[0]*c[5]-c[2]*c[3])/(c[0]*c[4]-c[1]*c[3]);

  cout << float_to_string(x, 3) << " " << float_to_string(y, 3) << endl;
}

int main(int argc, char const* argv[])
{
  int c[6];

  string line;
  while (getline(cin, line)) {
    istringstream iss(line);
    int val;
    int c[6];
    for (int i = 0; i < 6; i++) {
      iss >> val;
      c[i] = val;
    };

    calc_and_output(c);
  }

  return 0;
}

C++: #include<stdio.h>
int main()

{
    int a,b,c,d,e,f;
    while(~scanf("%d%d%d%d%d%d",a,b,c,d,e,f))
    {
        
        float x=(c*e-b*f)/(a*e-b*f);
        float y=(c*d-a*f)/(b*d-a*e);
        printf("%.3f %.3f\n",x,y);
        
    }
    return 0;
}