Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var strs []string
	var a, b, c, d, e, f float64
	var x, y float64
	for scanner.Scan() {
		strs = strings.Split(scanner.Text(), " ")
		_a, _ := strconv.Atoi(strs[0])
		_b, _ := strconv.Atoi(strs[1])
		_c, _ := strconv.Atoi(strs[2])
		_d, _ := strconv.Atoi(strs[3])
		_e, _ := strconv.Atoi(strs[4])
		_f, _ := strconv.Atoi(strs[5])
		a = float64(_a)
		b = float64(_b)
		c = float64(_c)
		d = float64(_d)
		e = float64(_e)
		f = float64(_f)
		y = (c*d - f*a) / (d*b - a*e)
		x = (c - b*y) / a

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

C++: using System;

// ガウス・ジョルダン法
// https://www.mk-mode.com/blog/2013/09/20/cpp-simultaneous-equation-by-gauss-jorden/#

namespace Prob0004
{
    class Program
    {
        static void Main(string[] args)
        {

            const int COLUMN = 2;
            const int ROW = 3;

            string line;
            while((line = Console.ReadLine()) != null)
            {
                // a[0][0]x + a[0][1]y = a[0][2]
                // a[1][0]x + a[1][1]y = a[1][2]
                string[] tokens = line.Split(' ');
                double[,] a = new double[COLUMN, ROW];
                for(int y = 0; y < COLUMN; y++)
                {
                    for (int x = 0; x < ROW; x++)
                    {
                        a[y, x] = double.Parse(tokens[y * ROW + x]);
                    }
                }


                for(int y = 0; y < COLUMN; y++)
                {
                    for (int x = 0; x < ROW; x++)
                    {
                        Console.Write("{0} ", a[y, x]);
                    }
                    Console.WriteLine("");
                }


                // pivot = (p, p)
                double coef;
                for (int p = 0; p < ROW - 1; p++)
                {

                    // ピボットのある行要素への処理
                    coef = a[p, p];
                    for (int x = p; x < ROW; x++)
                    { 
                        a[p, x] /= coef;
                    }

                    // ピボット以外の行要素への処理
                    for (int y = 0; y < COLUMN; y++)
                    {
                        if(p == y)
                        {
                            continue;
                        }

                        coef = a[y, p];
                        for (int x = p; x < ROW; x++)
                        {
                            a[y, x] -= a[p, x] * coef;
                        }
                    }

                    /*
                                        Console.WriteLine("");
                                        for (int y = 0; y < COLUMN; y++)
                                        {
                                            for (int x = 0; x < ROW; x++)
                                            {
                                                Console.Write("{0} ", a[y, x]);
                                            }
                                            Console.WriteLine("");
                                        }
                                        Console.WriteLine("");
                    */
                }

                // outputs
                for (int y = 0; y < COLUMN; y++)
                {
                    Console.Write("{0} ", a[y, ROW - 1].ToString("F3"));
                }
                Console.WriteLine();
            }

        }



    }
}

C++: #include <cstdio>

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

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

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

using namespace std;

int main(){
  for(double a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;){
    double x=(c*e-f*b)/(a*e-d*b);
    double y;
    if(e){
      y=(f-d*x)/e;
    }else{
      y=(c-a*x)/b;
    }
    if(fabs(x)<1e-4){
      x=0;
    }
    if(fabs(y)<1e-4){
      y=0;
    }
    cout<<fixed<<setprecision(3)<<x<<' '<<y<<endl;
  }
  return 0;
}

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




double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}


int main(){
    
	double ax, by, c, dx, ey, f;
    double x, y;
    double l, d1, d2;
        
	while(cin>> ax>> by>> c >> dx>> ey>> f){
        
        x = 0.0;
        y = 0.0;
        
        if(ax == dx){
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
            x = round(1000*x) / 1000;
            y = round(1000*y) / 1000;
        }
        else if (by == ey) {
            ax -= dx;
            x = (c-f) / ax;
            y = (f + dx*(-x)) / ey;
            x = round(1000*x) / 1000;
            y = round(1000*y) / 1000;
        }
        else{
            l = lcm(fabs(ax), fabs(dx));
            d1 = fabs(l / ax);
            d2 = fabs(l / dx);
            ax *= d1;
            by *= d1;
            c  *= d1;
            dx *= d2;
            ey *= d2;
            f  *= d2;
            
            by -= ey;
            y = (c-f) / by;
            x = (f + ey*(-y)) / dx;
            
            x = round(1000*x) / 1000;
            y = round(1000*y) / 1000;
        }
        
        printf("%.3f %.3f\n", x, y);
        
        
	}
    
    
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  double a,b,c,d,e,f;

 
  while( cin>>a>>b>>c>>d>>e>>f){
  
    double x,y;
  
    y=(c*d-a*f)/(b*d-a*e);
    x=(c-b*y)/a;
  
    //cout<<x<<' '<<y<<endl;
    printf("%.4lf %.4lf",x,y);
    cout<<endl;
  }
}

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

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (int) (1e9+7)
#define INF (int) 2e9

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