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 <bits/stdc++.h>
#include <math.h>
#include <iomanip>
using namespace std;

int main() {
  for(int i = 0; i < 31; i++){
    int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
    double x, y;
    cin >> a >> b >> c >> d >> e >> f;
    /*ax + by = c
      dx + ey = f
      行列で処理...?*/

      if(a == 0 && b == 0 && c == 0 && d == 0 && e == 0 && f == 0){
        break;
      }
      else{
        d * a * x + d * b * y - a * d * x - a * e * y == d * c - a * f;
        (d * b - a * e) * y == d * c - a * f;
        y = (d * c - a * f) / (d * b - a * e);
        //double Y = round(y * 1000); //1000倍して四捨五入して小数第4位までを取得
        //y = Y / 1000;
        x = (c - b * y) / a;
        //double X = round(x * 1000);
      //  x = X / 1000;

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

}

C++: #include <iostream>
#include <iomanip>
using namespace std;
int main() {
int a,b,c,d,e,f;
while (cin>>a>>b>>c>>d>>e>>f) {
 double Dx = c*e-b*f;
 double Dy = a*f-c*d;
 double D  = a*e-b*d;
 cout << fixed << setprecision(3) << Dx/D << ' ' << Dy/D << endl;
 }
return 0;
}

C++: #include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

// using matrix	?????????????????´??????
void func()
{
	int a, b, c, d, e, f;
	double x, y;

	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()){


	//	if ((a*e - d*b) == 0)
		{
		//	cout << 0 << space << 0 << endl;
		}
//		else
		{
			x = (e*c - b*f) / (a*e - d*b);
			y = (-d*c + a*f) / (a*e - d*b);

			cout << fixed << setprecision(3);
			cout << x << space << y << endl;
			cout << dec;
		}
	}
}

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

const double EPS = 1e-8;
typedef vector<double> vec;
typedef vector<vec> mat;

//Ax = b を解く
//O(n^3)
vec gauss_jordan(const mat &A, const vec &b){
  int n = A.size();
  mat B(n, vec(n+1));
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      B[i][j] = A[i][j];
  for(int i=0;i<n;i++) B[i][n] = b[i];

  for(int i=0;i<n;i++){
    int pivot = i;
    for(int j=i+1;j<n;j++) if(fabs(B[j][i]) > fabs(B[pivot][i])) pivot = j;
    swap(B[i],B[pivot]);

    //解がないか、あっても一意ではない。
    if(fabs(B[i][i]) < EPS) return vec();
    
    for(int j=i+1;j<=n;j++) B[i][j] /= B[i][i];
    for(int j=0;j<n;j++)
      if(i != j)
	for(int k=i+1;k<=n;k++)
	  B[j][k] -= B[j][i] * B[i][k];
  }
  vec x(n);
  for(int i=0;i<n;i++) x[i] = B[i][n];
  return x;
}

int main(){
  mat A(2,vec(2));
  vec b(2);
  while(cin >> A[0][0] >> A[0][1]){
    cin >> b[0];
    for(int i=0;i<2;i++) cin >> A[1][i];
    cin >> b[1];
    vec ans = gauss_jordan(A, b);
    printf("%.3f %.3f\n",ans[0],ans[1]);
  }
}

C++: #include<iostream>
using namespace std;
int main() {
	double a, b, c, d, e, f, x, y;
	while (cin >> a >> b >> c >> d >> e >> f) {
		x = (double)(c*e - b*f) / (a*e - b*d);
		y = (double)(c*d - a*f) / (b*d - a*e);
		cout << x << " " << y << endl;
	}
}

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;	
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<string>
using namespace std;
/*
??£???????¨????
	ax + by = c
	dx + ey = f
????§£x, y???????????????????????°??????
*/
int main() {
	double a, b, c, d, e, f;
	int cnt = 0;						//??\??????????????£???????¨????????????°
	std::vector<double> x_vector;		//x????§£???????´?
	std::vector<double> y_vector;		//y????§£???????´?

#if 0
	while (cnt < 2) {
		cin >> a >> b >> c >> d >> e >> f;
#else
	while (cin >> a >> b >> c >> d >> e >> f) {
#endif
		double x = (b * f - c * e) / (b * d - a * e);
		double y = (c * d - a * f) / (b * d - a * e);

		cnt++;
		x_vector.push_back(x);
		y_vector.push_back(y);
	}

	for (unsigned int i = 0; i < cnt; i++) {
		int dummy_x = x_vector[i];		//?????£????????????????°???°?????\?????????
		int dummy_y = y_vector[i];		//?????£????????????????°???°?????\?????????

		//x?????????????°???°????¬¬4???????????¨?????\
		if (5 <= (x_vector[i] * 10000 - dummy_x * 10000)) {
			x_vector[i] += 0.001;
		}

		//y?????????????°???°????¬¬4???????????¨?????\
		if (5 <= (y_vector[i] * 10000 - dummy_y * 10000)) {
			y_vector[i] += 0.001;
		}

		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x_vector[i] << " ";
		std::cout << std::setprecision(3) << y_vector[i] << endl;
		//???????????°
		//std::cout << std::setprecision(3) << x_vector[i] * 10000 << " ";
		//std::cout << std::setprecision(3) << y_vector[i] * 10000 << endl;
		//end???????????°
	}

	//???????????°
	while (1);

	return 0;
}

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

using namespace std;

int main() {
	double a, b, c, d, e, f, x, y, t;
	while(cin >> a >> b >> c >> d >> e >> f) {
		t = 1.0 / (a*e - b*d);
		x = (e*c - b*f) * t;
		y = (a*f - d*c) * t;
		x = abs(x) < 0.001 ? 0.0 : x;
		y = abs(y) < 0.001 ? 0.0 : y;
		cout << fixed << setprecision(3) << x
			 << ' '
			 << fixed << setprecision(3) << y
			 << endl;
	}
	return 0;
}

C++: #include <iostream>
#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){
	
		if (a==0){
			y = c / b;
			x = (f - (e*c/b)) / d;
		}else if(b==0){
			x = c / a;
			y = (f - (d*c/a)) / e;
		}else if(d==0){
			y = f / e;
			x = (c - (b*f/e)) / a;
		}else if(e==0){
			x = f / d;
			y = (c - (a*f/d)) / b;
		}else{
			x = (f - (e*c/b)) / (d - (e*a/b));
			y = (f - (d*c/a)) / (e - (d*b/a));
		}
		printf("%.3f %.3f/n",x,y);
	}
	return 0;
}

C++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  double a, b, c, d, e, f;
  while(cin >> a){
    cin >> b >> c >> d >> e >> f;
    double det = a * e - b * d;
    cout << setprecision(3);
    cout << fixed;
    cout << double((ll)((e * c - b * f) / det * 1000) / 1000.);
    cout << " ";
    cout << double((ll)((- d * c + a * f) / det * 1000) / 1000.) << endl;
  }
	return 0;
}

C++: #include <cstdio>

int main(){
    int a,b,c,d,e,f;
    while(scanf("%d %d %d %d %d %d", &a,&b,&c,&d,&e,&f)+1){
        double x = (c*e-b*f)/(a*e-b*d);
        double y = (c*d-a*f)/(b*d-a*e);
        printf("%.3lf %.3lf\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 (1) {
		cin>>a>>b>>c>>d>>e>>f;
		if (cin.eof()) break;

		x = (f/e-c/b)/((-a/b)-(-d/e));
		if ((int)(x*1000)%1000>=5) x+=0.001;
		y = (-a/b)*x+c/b;
		if ((int)(y*1000)%1000>=5) y+=0.001;

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

	return 0;
}