Go: package main

import "fmt"

func main() {
	var Xs, Ys []float32
	Xs = make([]float32, 0)
	Ys = make([]float32, 0)
	var cnt 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
		}
		y = (((a * f) - (d * c)) / ((a * e) - (b * d)))
		x = ((c - (b * y)) / a)
		Xs = append(Xs, x)
		Ys = append(Ys, y)
		cnt++
	}
	for i := 0; i < cnt; i++ {
		fmt.Printf("%.3f %.3f\n", Xs[i], Ys[i])
	}
}

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

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

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main(void){
    
    int i,j=0,k = 0,l=0,m = 0,n= 0;
    double a,b,c,d,e,f;
    double x1,x2;
    
    cin >> a >> b >> c;
    cin >> d >> e >> f;
    
    double gyouretusiki = (a*e - d*b);
    
    x1 = (c/a) - (b/gyouretusiki)*(f -((d*c)/a));
    
    x2 = ((a) /(gyouretusiki))*(f-((d*c)/a));
    
    REP(i,5)
    {
    x1 =x1*10;
    x2 = x2*10;
    }
    x1 += 0.5;
    x2 += 0.5;
    x1 = (int)x1;
    x2 = (int)x2;
    REP(i,5)
    {
        x1 =x1/10;
        x2 = x2/10;
    }
    
    printf("%.3f %.3f\n",x1,x2);
    return 0;
            
                  
                  
    
}

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

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

C++: #include <iostream>
#include<cstdio>
 
using namespace std;
 
int main()
{
    double a, b, c, d, e, f, tmp, s, t;
     
    while((cin >> a >> b >> c >> d >> e >> f)){
        tmp = (a*e-b*d);
        s = ((e*c-b*f)/tmp);
        t = ((a*f-d*c)/tmp);
         
        if(s == -0.0){
            s = 0.0;
        }
        if(t == -0.0){
            t = 0.0;
        }
        printf("%.3f %.3f\n", s, t);
    }
     
    return 0;
}

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

const double EPS = 1e-8;
typedef vector<double> Vec;
typedef vector<Vec> Mat;

void show(const Mat &m)
{
	puts("====");
	for (int i = 0; i < m.size(); i++){
		for (int j = 0; j < m[i].size(); j++){
			printf("%f ", m[i][j]);
		}
		puts("");
	}
	puts("====");
}

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];
		}
		B[i][n] = b[i];
	}
	
	for (int i = 0; i < n; i++){
		int pivot = i;
		for (int j = i; j < n; j++){
			if (abs(B[j][i]) > abs(B[pivot][i])){
				pivot = j;
			}
		}
		swap(B[i], B[pivot]);
		
		if (abs(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];
				}
			}
		}
		
		//show(B);
	}
	
	Vec x(n);
	for (int i = 0; i < n; i++){
		x[i] = B[i][n];
	}
	
	return x;
}

int main()
{
	while (true){
		Mat A(2, Vec(2));
		Vec b(2);
		
		for (int i = 0; i < 2; i++){
			for (int j = 0; j < 2; j++){
				scanf("%lf", &A[i][j]);
			}
			scanf("%lf", &b[i]);
		}
		
		Vec res = gauss_jordan(A, b);
		printf("%.3f %.3f\n", res[0], res[1]);
	}
	
	return 0;
}

C++: #include <cstdio>

int main(){
	int arr[10][10],p,q;
	float h[5];

	while(scanf("%d %d %d %d %d %d",&arr[1][1],&arr[1][2],&arr[1][3],&arr[2][1],&arr[2][2],&arr[2][3])!=EOF){
		//printf("%d %d %d %d %d %d \n",arr[1][1],arr[1][2],arr[1][3],arr[2][1],arr[2][2],arr[2][3]);
		/*if(arr[1][1] < 0){
			for(int k = 1;k<4;k++){
				arr[1][k] = arr[1][k]*(-1);
			}
		}

		if(arr[2][1] < 0){
			for(int l = 1;l<4;l++){
				arr[2][l] = arr[2][l]*(-1);
			}
		}*/

		for(int i = 4;i<7;i++){
			arr[1][i] = arr[1][i-3]*arr[2][1];
			arr[2][i] = arr[2][i-3]*arr[1][1];
		}

		p = arr[1][5]-arr[2][5];
		q = arr[1][6]-arr[2][6];

		h[2] = q/p;

		h[1] = (arr[1][3]-(arr[1][2]*h[2]))/arr[1][1];

		printf("%.3f %.3f\n", h[1],h[2]);
	}
}

C++: int gcm(int a,int b){
	int c=a%b;
	while(c!=0){
		a=b;
		b=c;
		c=a%b;
        }
	return b;
}

int main(){
	int x[2],y[3],sum[3];
	double ans[2];
	while(cin>>x[0]>>y[0]>>sum[0]>>x[1]>>y[1]>>sum[1]){
		if(x[0]==0){
			ans[1]=(double)sum[0]/y[0];
			ans[0]=(sum[1]-y[1]*ans[1])/x[1];
		}else if(x[1]==0){
			ans[1]=(double)sum[1]/y[1];
			ans[0]=(sum[0]-y[0]*ans[1])/x[0];
		}else if(y[0]==0){
			ans[0]=(double)sum[0]/x[0];
			ans[1]=(sum[1]-x[1]*ans[0])/y[1];
		}else if(y[1]==0){
			ans[0]=(double)sum[1]/x[1];
			ans[1]=(sum[0]-x[0]*ans[0])/y[0];
		}else{
			y[2]=y[0]*x[1]-y[1]*x[0];
			sum[2]=sum[0]*x[1]-sum[1]*x[0];
			ans[1]=(double)sum[2]/y[2];
			ans[0]=(sum[0]-y[0]*ans[1]);
		}
		printf("%.3f %.3f\n",ans[0],ans[1]);
	}
	return 0;
}

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

class Calc{
    public:
    double A[N][N+1];
    int i, j, k;

    void calcSi();
    void printSi();
}

void Calc::calcSi(){
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            int tmp = A[j][i] / A[i][i];
            for(k=i+1; k<=N; k++)
                A[j][k] -= A[i][k] * tmp;
        }
    }

    for(i=N-1; i>=0; i--){
        tmp = A[i][N];
        for(j=i+1;j<N;j++)
            tmp -= A[i][j] * A[j][N];
        A[i][N] = tmp / A[i][i];
    }
}

void Calc::printSi(){
    for(i=0;i<N;i++){
        printf("%.3f",A[i][N]);
        if(i != N) {
            cout << " ";
        }
    }
    cout << endl;
}

int main(void){
    Calc c;
    int i;
    while(cout >> c.A[0][0] >> c.A[0][1] >> c.A[0][2] >> c.A[1][0] >> c.A[1][1] >> c.A[1][2])
    {
        c.calcSi();
        c.printSi();
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector> 
#include <iomanip>
int main()
{
	std::vector<double> x, y;
	double a, b, c, d, p, q;
	while (scanf("%d %d %d %d %d %d", &a, &b, &p, &c, &d, &q) != EOF)
	{
		x.push_back((d*p - b*q) / (a*d - b*c));
		y.push_back((a*q - c*p) / (a*d - b*c));
	}

	for (int i = 0; i < x.size(); ++i)
		std::cout << std::setprecision(10) << x[i] << " " << std::setprecision(10) << y[i] << std::endl;
	return 0;
}

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()
{
    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;
}