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<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		int a2 = a, b2 = b, c2 = c;
		int g = a, h = d;
		if (g > h) swap(g, h);
		while (g != 0) {
			int k = g;
			g = h%g;
			h = k;
		}
		h = (h*(a / h)*(d / h));
		b = b*(h / a);
		c = c*(h / a);
		e = e*(h / d);
		f = f*(h / d);
		long double ansx = ((long double)(f - c) / (e - b)), ansy;
		ansy = (c2 - ansx*b2) / a2;
		printf("%LF %LF", ansy, ansx);
		cout << endl;
	}
}

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

void solv(
	double a,
	double b,
	double c,
	double d,
	double e,
	double f,
	double & x,
	double & y){
	y = (f - (d*c)/a)/(e - (b*d)/a);
	x = (c - b*y)/a;
}

int main(){
	std::vector<std::pair<double, double>> ans;

	double a,b,c,d,e,f;
	std::pair<double, double> tmp;

	while(true){
		std::cin >> a >> b >> c >> d >> e >> f;
		if(std::cin.eof() == true) break;
		solv(a,b,c,d,e,f,
			tmp.first, tmp.second);
		ans.push_back(tmp);
	}

	for(auto && a : ans){
		printf("%0.4f %0.4f\n", a.first, a.second);
	}
}

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

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

    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#define eps 1e-9
using namespace std;

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

    while(cin>>a>>b>>c>>d>>e>>f){
        x = ((e*c)-(b*f))/((a*e) - (b*d)) *1.0;
        y = ((a*f) - (c*d))/((a*e) - (b*d)) *1.0;

        printf("%.3lf %.3lf\n",x+eps,y+eps);
    }
    return 0;
}

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

using namespace std;

double a, b, c, d, e, f;
double x, y;

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

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

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>

#include <cstdio>

#define DIM 2

typedef std::vector<double> Vec;
typedef std::vector<Vec> Mat;
typedef std::pair<Mat,Vec> Eq;

int main(void){
	using namespace std;

	list<Eq> input;

	double a,b,c,d,e,f;

	cout << fixed << setprecision(3);

	while(cin >> a >> b >> c >> d >> e >> f){
		Vec m1, m2;
		m1.push_back(a);
		m1.push_back(b);
		m2.push_back(d);
		m2.push_back(e);

		Vec vec;
		vec.push_back(c);
		vec.push_back(f);

		Mat mat;
		mat.push_back(m1);
		mat.push_back(m2);

		Eq eq = make_pair(mat,vec);

		input.push_back(eq);
	}

	for(auto itr = input.begin(); itr!=input.end(); ++itr){
		auto mat = itr->first;
		auto vec = itr->second;

		Vec output(DIM);

		auto det = mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
		std::transform(vec.begin(), vec.end(),vec.begin(), std::bind1st(multiplies<double>(),1.0/det));

		mat[0][1] = -mat[0][1];
		mat[1][0] = -mat[1][0];
		swap(mat[0][0],mat[1][1]);

		for (int i=0; i<DIM; i++){
			output[i] = inner_product(vec.begin(), vec.end(), mat[i].begin(), 0);
		}

		// cout << output[0] << " " << output[1];
		printf("%.3f %.3f\n",output[0],output[1]);
	}

}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){

  double a,b,c,d,e,f;

  cin >> a >> b >> c >> d >> e >> f;
  
  if(c*e==f*b||a*e==d*b) printf("0.000 ");
  else printf("%.3f ",(c*e-f*b)/(a*e-d*b));
  if(c*d==f*a||b*d==e*a) printf("0.000\n");
  else printf("%.3f\n",(c*d-f*a)/(b*d-e*a));

  return (0);
}

C++: #include<iostream>

double a, b, c, d, e, f;
bool flag;

int main()
{
	while(std::cin>>a>>b>>c>>d>>e>>f)
	{
		double x = (e*c-b*f)/(a*e-b*d);
		double y = (-d*c+a*f)/(a*e-b*d);
		printf("%8.3f %8.3f\n",x,y);
	}
	return 0;
}

C++: //Simultaneous Equation

#include <iostream>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <cfloat>

namespace {

inline bool is_nearly_zero(double x)
{
  if (abs(x) < DBL_EPSILON)
    return true;
  else
    return false;
}

}

int main()
{
  while (1) {
    double x, y;
    double a, b, c, d, e, f;
    std::cin >> a >> b >> c >> d >> e >> f;
    if (std::cin.fail()) break;

    const double det = (a * e) - (b * d);
    assert(!is_nearly_zero(det));

    const double inv_mat[2][2] = {
    	{e, -b},
    	{-d, a}
    };

    x = ((inv_mat[0][0] * c) + (inv_mat[0][1] * f)) / det;
    y = ((inv_mat[1][0] * c) + (inv_mat[1][1] * f)) / det;

	if (is_nearly_zero(x)) x = 0.0;
	if (is_nearly_zero(y)) y = 0.0;
	
    printf("%.3f %.3f\n", x, y);
  }

  return 0;
}

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

using namespace std;

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

	while (cin >> a >> b >> c >> d >> e >> f)
	{
		odd = b / e;

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

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

	}


	return 0;
}

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

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

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
 
int main() {
    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 / a - b * y / a;
        x *= 1000;
        x = (int)(x + 0.5 - (x < 0));
        x /= 1000;
        y *= 1000;
        y = (int)(y + 0.5 - (y < 0));
        y /= 1000;
        printf("%.3f %.3f\n", x, y);
    }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double m[2][2],ans[2],rev[2][2];
  while(cin >>m[0][0]>>m[0][1]>>ans[0]>>m[1][0]>>m[1][1]>>ans[1]){
    double det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    rev[0][0] = m[1][1]/det;
    rev[0][1] = -m[0][1]/det;
    rev[1][0] = -m[1][0]/det;
    rev[1][1] = m[0][0]/det;
    double x = ans[0]*rev[0][0]+ans[1]*rev[0][1];
    double y = ans[0]*rev[1][0]+ans[1]*rev[1][1];
    printf("%.3lf %.3lf\n",x,y);
  }
  return 0;
}