Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	for {
		data := nextInts(6)
		if data[0] == 0 || data[1] == 0 || data[2] == 0 || data[3] == 0 || data[4] == 0 || data[5] == 0 {
			break
		}
		fmt.Printf("%.3f\n", Round(GetX(data[0], data[1], data[2], data[3], data[4], data[5]), 3))
		fmt.Printf("%.3f\n", Round(GetY(data[0], data[1], data[2], data[3], data[4], data[5]), 3))
	}
}

func GetX(a, b, c, d, e, f float64) float64 {
	return ((c * e) - (b * f)) / ((a * e) - (b * d))
}

func GetY(a, b, c, d, e, f float64) float64 {
	return ((c * d) - (a * f)) / ((b * d) - (a * e))
}

func Round(f float64, places int) float64 {
	shift := math.Pow(10, float64(places))
	return math.Floor(f*shift+.5) / shift
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() float64 {
	a, _ := strconv.Atoi(next())
	return float64(a)
}

func nextInts(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	return a
}

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

int main(){
  while(cin){
    double A[2][3];
    for(int i=0;i<2;i++){
      for(int j=0;j<3;j++){
	cin>>A[i][j];
      }
    }
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++){
	A[i][j] /= A[i][i];
      }
      for(int k=0;k<2;k++){
	if(k!=i){
	  
	  for(int j=i+1;j<3;j++) A[k][j] -= A[k][i]*A[i][j];
	}
      }
    }
    cout<<fixed<<setprecision(3)<<A[0][2]<<" "<<A[1][2]<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
 double a,b,c,d,e,f,y[10000],x[10000];
 int i=0,n;
while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f) != EOF){
  y[i]=((c*d)-(a*f))/((b*d)-(a*e));
  x[i]=((c*e)-(b*f))/((a*e)-(b*d));
  i++;
}
  n=i;
  for(i=0;i < n; i++){
  if(x == 0){x = 0;}
  if(y == 0){y = 0;}
  printf("%.3lf %.3lf\n", x[i],y[i]);
  }
  return 0;
}

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

using namespace std;

typedef struct {
        double x1;
        double x2;
} answer;

answer solve_simultaneous_equations(double a, double b, double c, double d, double e, double f) {
        answer ans;
        ans.x1 = (c*e - b*f) / (a*e - b*d);
        ans.x2 = (c*d - a*f) / (b*d - a*e);
        return ans;
}

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

        while(cin >> a >> b >> c >> d >> e >> f) {
                answer ans;
                ans = solve_simultaneous_equations(a,b,c,d,e,f);
                cout << showpoint << fixed << setprecision(3) << ans.x1;
                cout << " ";
                cout << showpoint << fixed << setprecision(3) << ans.x2;
                cout << endl;
        }

        return 0;
}

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

int main(){
double a,b,j,d,e,f,a_,b_,c_,d_,e_,f_;
double x,y;
double in;
while (std::cin >>a>>b>>c>>d>>e>>f){
in_ = (a*e - b*d);
a_ = a/in;
b_ = -1*d/in;
d = -1*b/in;
e_ = e/in;
x = c * a_ + f*b_;
y = c*d_ + f*e_;
std::cout << std::setprecision(3) << x << ' ' << std::setprecision(3) << y << std::endl;
}
    return 0;
}

C++: #include <stdio.h>

double sishagonyu(double num)	{
	
	int num2;
	
	if (num == 0) return num;
	if (num > 0) { 
		num += 0.0005;
	} else {
		num -= 0.0005;
	}
	
	num *= 1000;
	num2 = (int)num;
	num = num2;
	num /= 1000;
	
	return num;
}

int main() {
	
	double a, b, c, d, e, f;	//scanf
	double x, y;							//ans
	
	double n = 0, m = 0, j = 0, h = 0, i = 0;						//temp
	
	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		
		//if (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == EOF) break;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\n", a, b, c, d, e, f);	//input
		
		n = a / d;
		
		j = d * n;
		h = e * n;
		i = f * n;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\t\t%lf\n", a, b, c, j, h, i, n);
		
		m = b - h;
		y = c - i;
		//printf("%lf %lf\n", m, y);
		
		if(y != 0) y /= m;
		//printf("%lf\n", y);
		
		i = c - (b * y);
		x = i / a;
		
		//printf("x = %lf, y = %lf\n", x, y);
		
		//x = sishagonyu(x);
		//y = sishagonyu(y);
		
		//printf("%lf %lf\n", x, y);
		printf("%.3lf %.3lf\n", x, y);
			}
	return 0;
}

C++: #include <iostream> //üoÍ
#include <vector>   //®Izñ
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
	double n;
	while(cin >> n){
		vector<double> vec;
		vec.push_back(n);
		for(int i=0;i<5;i++){
			cin >> n;
			vec.push_back(n);
		}
		double x = ((vec[2]*vec[4])-(vec[1]*vec[5]))/((vec[0]*vec[4])-(vec[1]*vec[3]));
		double y = (vec[2]-(vec[0]*x))/vec[1];

		x = floor((x*1000)+0.5)/1000;
		y = floor((y*1000)+0.5)/1000;
		printf("%.3f %.3f\n", x, y);
		
	}
	
		return 0;
}

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



int main()
{
double x1,x2,y1,c1,y2,c2,y,x;
while((scanf("%lf %lf %lf %lf %lf %lf",&x1,&x2,&y1,&y2,&c1,&c2))!=EOF)
{
x=((c1*y1-x2*c2)/(x1*c1-x2*y2));
y=((-(y2*y1)+x1*c2)/(x1*c1-x2*y2));
if(x==0)
{
x=0;
}
if(y==0)
{
y=0;
}
printf("%.3lf %.3lf\n",x,y);
}
return 0;
}

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

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

	cin >> a >> b >> c >> d >> e >> f;

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

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

	return 0;
}

C++: #include <iostream>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;
#define F first
#define S second
const int INF=100000000;

int dp[50][3001];
const int mod=100000;

int main(){
	while(1){
		double n[6];
		double tmp[6];
		for(int i=0; i<6; ++i){
			cin >> n[i];
			tmp[i]=n[i];
		}

		double p=n[1]/n[4];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*p;
		double x=(tmp[2]-tmp[5])/(tmp[0]-tmp[3]);
		
		double q=n[0]/n[3];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*q;
		double y=(tmp[2]-tmp[5])/(tmp[1]-tmp[4]);

		printf("%.3f %.3f\n",x,y);
		//cout << setprecision(3)  << x << " " << y << endl;
	}
	return 0;
}

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

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 >> c[0][0] >> c[0][1] >> c[0][2] >> c[1][0] >> c[1][1] >> c[1][2])
	{
		// 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;
}