Go: package main

import "fmt"

func main() {
	var resultX, resultY [100]float32
	var count int
	for {
		var a, b, c, d, e, f, x, y float32
		fmt.Scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)
		if a == 0 {
			break
		}
		//Simultaneous equation
		y = (((a * f) - (d * c)) / ((a * e) - (b * d)))
		x = ((c - (b * y)) / a)
		resultX[count] = x
		resultY[count] = y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%.3f %.3f\n", resultX[i], resultY[i])
	}
}

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

using namespace std;

// a = 1のとき
// x = c - by
// d(c-by)*ey=f
// y = (f - dc) / (e - db)

double func1(double y1, double r1, double x2, double y2, double r2) {
	double temp1 = x2 * y1;
	double temp2 = x2 * r1;
	return (r2 - temp2) / (y2 - temp1);
}

int main() {

	double a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		double x = 0.0, y = 0.0;

		// double型は等価比較してはいけないといわれるが、
		// 一度も計算していないためこのケースは問題なし
		if (a == 1.0) {
			y = func1(b, c, d, e, f);
			x = c - b * y;
		}
		else if (d == 1.0) {
			y = func1(e, f, a, b, c);
			x = f - e * y;
		}
		else if (b == 1.0) {
			x = func1(a, c, e, d, f);
			y = c - a * x;
		}
		else if (e == 1.0) {
			x = func1(d, f, b, a, c);
			y = f - d * x;
		}
		else {
			// aが1となるように計算
			double a_1 = 1.0, b_1 = b / a, c_1 = c / a;
			y = func1(b_1, c_1, d, e, f);
			x = c_1 - b_1 * y;
		}

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

	return 0;
}

C++: #include <stdio.h>

int main(){
	int a,b,c,d,e,f;
	double x,y;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF){
	x=(c*e-f*b)/(a*e-d*b);
	y=(a*f-d*c)/(a*e-b*d);
	x=x*1000;
	if(x>0) x=(double)(int)(x+0.5);
	else  x=(double)(int)(x-0.5);
	x=x/1000;
	y= y*1000;
	if(y>0) y=(double)(int)(y+0.5);
	else y=(double)(int)(y-0.5);
	y=y/1000;
	printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

C++: #include <iostream>

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 = (c*d - a*f) / (b*d - a*f);

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

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

using namespace std;

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

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

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

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

int main(){

    double a,b,c,d,e,f,y,x,bb,cc,dd,ee,ff;
    while(cin>>a>>b>>c>>d>>e>>f){
        bb=b/a;
        cc=c/a;
        ee=e/d;
        ff=f/d;
        y=(cc-ff)/(bb-ee);
        x=(c-b*y)/a;
        y=1000*y;
        y=(int)y;
        y=y/1000;
        
        x=1000*x;
        x=(int)x;
        x=x/1000;
        cout<<fixed<<setprecision( 3 )<<x<<" "<<y<<endl;
        //printf("%f %f\n",x,y);
    }
    return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f)
    {
        double y = (c*d - a*f) / (b*d - a*e);
        double x = (c - b*y) / a;
        printf("%.3lf %.3lf\n", x, y);
    }
}

C++: #include <iostream>
#include <iomanip>
int main(void)
{
    double a,b,c,d,e,f;
    int x,y;
    std::cout << std::showpoint << std::setprecision(4);
    while(std::cin >> a >> b >> c >> d >> e >> f){
        x = ((c * e - b * f) / (a * e - b * d) * 1000 + 0.5);
        y = ((f * a - c * d) / (a * e - b * d) * 1000 + 0.5);
        std::cout << x / 1000.0 << " " << y / 1000.0 << std::endl;
    }
    return 0;
}

C++: #include<stdio.h>

int main(void)
{
	double a, b, c, d, e, f, x, y;
	double result[10000][2];
	int i, j;
	
	i = 0;
	
	while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
		x = ((e * f) + (-1 * e * c)) / ((b * d) + (-1 * a * e));
		
		y = ((a * f) + (-1 * d * c)) / ((a * e) + (-1 * b * d));
		
		result[i][0] = x;
		result[i][1] = y;
		
		i++;
	}
	
	for (j = 0; j < i; j++) {
		printf("%lf %lf\n", result[j][0], result[j][1]);
	}
	
	return (0);
}

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

using namespace std;

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

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

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

			if(x % 10000 >= 5){
				x += 0.001;
			}if(y % 10000 >= 5){
				y += 0.001;
			}

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

	return 0;
}

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

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

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

int main(void){
	int a,b,c,d,e,f;
	a=b=c=d=e=f=0;
	float x=0.0f;
	float y=0.0f;
	while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF){
		x = (c*e-f*b)/(float)(a*e-b*d)+0.0005;
		y = (c*d-f*a)/(float)(b*d-e*a)+0.0005;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

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


int main(){
	vector<double> ans_x;
	vector<double> ans_y;
	double a, b, c, d, e, f;
	double tb, tc, te, tf;
	double x, y;
	int i, cnt=0;
	while(cin>>a>>b>>c>>d>>e>>f){
		tb=b*d;
		tc=c*d;
		te=e*a;
		tf=f*a;
		tb-=te;
		tc-=tf;
		y=tc/tb;
		x=(c-b*y)/a;
		ans_x.push_back(x);
		ans_y.push_back(y);
		cnt++;
	}
	for(i=0;i<cnt;i++){
		cout.precision(4);
		cout.setf(ios::showpoint);
		cout << ans_x[i] << ' ' << ans_y[i] << endl;
	}
	return 0;
}

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

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

C++: #include <iomanip>
#include <iostream>
#include <vector>
#define N 2
 
using namespace std;
typedef vector< vector<double> > Equation;
 
bool input(Equation& c)
{
	if (!cin) return false;

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N + 1; ++j)
            cin >> c[i][j];
 
    return true;
}
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
 
    Equation c(N, vector<double>(N + 1));
	while (cin)
	{
		for (int i = 0; i < N; ++i)
			for (int j = 0; j < N + 1; ++j)
				cin >> c[i][j];

		// Gaussian elimination
		// 1. Forward elimination
        for (int i = 0; i < N - 1; ++i)
            for (int j = i + 1; j < N; ++j)
            {
                double d = c[j][i] / c[i][i];
                for (int k = i + 1; k <= N; ++k)
                    c[j][k] -= c[i][k] * d;
            }
 
		// 2. Back substitution
        for (int i = N - 1; i >= 0; --i)
        {
            double d = c[i][N];
            for (int j = i + 1; j < N; ++j)
                d -= c[i][j] * c[j][N];
            c[i][N] = d / c[i][i];
        }
 
        cout << setprecision(4) << fixed << c[0][N];
        for (int i = 1; i < N; ++i)
            cout << " " << c[i][N];
        cout << endl;
    }
 
    return 0;
}