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++: using namespace std;

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

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

		d = d - a;           // d = 0
		e = e - b;
		f = f - c;
	
		f = f * b / e;
		e = e * b / e;


		b = b - e;            // b = 0
		c = c - f;

		c = c / a;            // x = c
		a = a / a;

		f = f / e;            // y = f
		e = e / e;

		cout << fixed << setprecision(3) << c << " " << fixed << setprecision(3) << f << endl;
	}

	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 round(double dat, int keta){
	int fct;

	fct = (int)pow(10, keta - 1);
	dat *= fct;
	dat += (dat < 0) ? -0.5 : 0.5;
	dat = (int)(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) << round(x1,3) << " " << round(y1,3) << endl;
	cout << fixed << setprecision(3) << round(x2,3) << " " << round(y2,3) << endl;

	return 0;
}

C++: #include "iostream"
#include "cstdio"
using namespace std;

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

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

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

    }
    
    return 0;
}

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

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

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int b,a,e,d,f,i,c;
	float y,x;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)  {
			y=(c*d-a*f)/(b*d-a*e);
			x=(c-(b*y))/a;
		if(x<0.0000 && x>-0.0000001){
			x=0.0000;
		}
		if(y<0.000&&y>-0.0000001){
			y=0.0000;
		}	
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

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

using namespace std;

int main() {
    double a, b, c, d, e, f, x, y, det;
    while (true) {
        cin >> a >> b >> c >> d >> e >> f;
        if (cin.eof()) {
            return 0;
        }
        det = a*e-b*d;
        x = (c*e-b*f)/det;
        y = (a*f-c*d)/det;
        if (abs(x) < 0.0005) {
            x = 0;
        }
        if (abs(y) < 0.0005) {
            y = 0;
        }
        cout << std::fixed << setprecision(3) << x << ' ' << y << endl;
    }
}

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

int main(){
  double a, b, c, d, e, f;
  cout << fixed;
  cout << setprecision(3);

  while(cin >> a >> b >> c >> d >> e >> f){
    if(c*e == b*f)
      cout << 0.000 << " ";
    else
      cout << (c*e -b*f)/(a*e - b*d) << " ";
    if(c*d == a*f)
      cout << 0.000 << " ";
    else
      cout << (c*d - a*f)/(b*d - a*e) << endl;
  }

  cout << d << " " << e << endl;
  return 0;
}

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

int main(void){
	double x1[1000],y1[1000];
	int a[1000],b[1000],c[1000],d[1000],e[1000],f[1000],i=0,j,r=0,x2[1000],y2[1000];
    
    while(r==0)
	{
		scanf("%d %d %d %d %d %d",&a[i],&b[i],&c[i],&d[i],&e[i],&f[i]);
	    x2[i] = (c[i] * e[i] -b[i] * d[i]) / (a[i] * e[i] - b[i] * d[i])*1000+0.5;
	    y2[i] = (d[i] * c[i] -a[i] * f[i]) / (b[i] * d[i] - a[i] * e[i])*1000+0.5;

		if(a[i] < -1000 || a[i] > 1000  || b[i] < -1000 || b[i] > 1000 ||
		   c[i] < -1000 || c[i] > 1000  || d[i] < -1000 || d[i] > 1000 || 
		   e[i] < -1000  || e[i] > 1000 || f[i] < -1000 || f[i] > 1000)break;
		
		i=i+1;
	}
	for(j=0;j<i;j++)
	{
		x1[j]=x2[j]/1000;
		y1[j]=y2[j]/1000;
		printf("%f %f\n",x1[j],y1[j]);
	}
  return 0;
}

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

int main()
{
    int a,b,c,d,e,f;
    double x,y;
    for(int i=0;i<2;i++){
        cin>>a>>b>>c>>d>>e>>f
        double l,m,n;
        l=a/d;
        m=b-e*l;
        n=c-f*l;
        y=n/m;
        x=(c-b*y)/a;
        cout<<x<<" "<<y<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
int main(){
	double a,b,c,d,e,f;
	double x,y;
	while(std::cin>>a>>b>>c>>d>>e>>f){
	y=(a*f-d*c)/(a*e-b*d);
	x=(c-b*y)/a;
	printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: //
//  main.cpp
//  CppTest
//
//  Created by Ryu on 2017/02/08.
//  Copyright ?? 2017??´ Ryu. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    float e[10000][6];
    int n = 0;
    float x[10000], y[10000];
    while (cin >> e[n][0] >> e[n][1] >> e[n][2] >> e[n][3] >> e[n][4] >> e[n][5]) {
        float d = e[n][0] * e[n][4] - e[n][1] * e[n][3];
        x[n] = (e[n][4] * e[n][2] - e[n][1] * e[n][5]) / d;
        y[n] = (0 - e[n][3] * e[n][2] + e[n][0] * e[n][5]) / d;
        //printf("d: %f, x: %.4f, y: %.4f\n", d, x[n], y[n]);
        n++;
    }
    
    
    for(int i = 0; i < n; i++){
        if(x[i] == -0){
            x[i] = 0;
        }
        if(y[i] == -0){
            y[i] = 0;
        }
        printf("%.3f %.3f\n", x[i], y[i]);
    }
    
    
    return 0;
}

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

using namespace std;

typedef struct Shiki{
  double a,b,c;//ax+by=c
  double x,y;
};

Shiki Equation (Shiki, Shiki);

Shiki clean={clean.a=0,clean.b=0,clean.c=0,clean.x=0,clean.y=0};

main(){
  Shiki shiki1,shiki2;
  vector<Shiki> ans;
  int i=0;
  
  while(cin){

    cin>>shiki1.a>>shiki1.b>>shiki1.c>>shiki2.a>>shiki2.b>>shiki2.c;
    ans.push_back(Equation(shiki1,shiki2));
    i++;
    shiki1 = clean;
    shiki2 = clean;
  }
 
  for(int j = 0; j < i-1 ;j++){
    cout<< fixed << setprecision(3) << ans[j].x << " " << ans[j].y << endl; 
  }
}

Shiki Equation (Shiki A, Shiki B){
  Shiki ans,preA;
  int x,y,aa,ba;
  
  preA = A;

  aa = A.a;
  ba = B.a;
  
  A.a *= ba;
  A.b *= ba;
  A.c *= ba;
  
  B.a *= aa;
  B.b *= aa;
  B.c *= aa;
  
  ans.a = 0;
  ans.b = A.b - B.b;
  ans.c = A.c - B.c;
  ans.y = ans.c / ans.b;
  ans.x = (preA.c - preA.b*ans.y)/preA.a;
  
  if((int)(ans.y*1000)%10 >= 5)ans.y += 0.0001;
  if((int)(ans.y*1000)%10 >= 5)ans.x += 0.0001;
  
  return ans;
}

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

int main()
{
	
	// 係数行列
	double A[2][2];
	
	// 定数ベクトル
	double  B[2];
	
	// 解ベクトル
	double x[2];
	
	
	double a, b, c, d, e, f;
	// 入力の最後まで処理する
	while(cin >>a >>b >>c >>d >>e >>f){
	A[0][0] = a;
	A[0][1] = b;
	A[1][0] = d;
	A[1][1] = e;
	
	B[0] = c;
	B[1] = f;
	
	
	
	int i,j,k;
	double tmp;
	
	// 前進消去
	for(i=0;i<1;i++){
		for(j=i+1;j<2;j++){
			for(k=i+1;k<2;k++){
				A[j][k] = A[j][k] - (A[j][i]/A[i][i])*A[i][k];
			}
			B[j] = B[j] - (A[j][i]/A[i][i])*B[i];
		}
	}
	
	// 後退代入
	for(i=1;i>=0;i--){
		tmp = B[i];
		for(j=i+1;j<2;j++){
			tmp = tmp - A[i][j]*x[j];
		}
		x[i] = tmp/A[i][i];
	}
	
	printf("%4lf %4lf\n", x[0], x[1]);
	
	}
	
	return 0;
}