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 <iomanip>
using namespace std;

int main(void){

	while (true){
		int a, b, c, d, e, f;
		cin>>a>>b>>c>>d>>e>>f;
		if (cin.eof()) break;

		float x, y, tmp;
		tmp = (a*e-b*d);
		if (tmp>0){
			x = (c*e-b*f)/tmp;
			y = -(c*d-a*f)/tmp;
		}
		else{
			x = (-c*e+b*f)/(-tmp);
			y = (c*d-a*f)/(-tmp);
		}

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

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

C++: #include <iostream>
using namespace std;
int main(){
	double a,b,c,d,e,f,x,y;
	int xx,yy;
	while(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);
		printf("%d.",(int)x);
		printf("%d",(int)(x*10)-(int)x*10);
		printf("%d",(int)(x*100)-(int)x*100);
		printf("%d",(int)(x*1000)-(int)x*1000);
		printf(" ");
		printf("%d.",(int)y);
		printf("%d",(int)(y*10)-(int)y*10);
		printf("%d",(int)(y*100)-(int)y*100);
		printf("%d",(int)(y*1000)-(int)y*1000);
		printf("\n");
	}
	return 0;
}

C++: #include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;



int main()
{
	double a[3], b[3];
	while (cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2])
	{
		if (a[0] == 0)
		{
			double c = a[2] / a[1];
			double d = (b[2] - b[1] * c) / b[1];
			a[2] = d;
			b[2] = d;
		}
		else
		{
			double c = 1;
			if (b[0] != 0)
			{
				c = a[0] / b[0];
				b[1] = b[1] * c - a[1];
				b[2] = b[2] * c - a[2];
			}
			b[2] /= b[1];
			b[1] = 1;
			a[2] -= b[2] * a[1];
			a[2] /= a[0];
		}
		if (a[2] < 0.0001 && a[2] > -0.0001)
			a[2] = 0.000;
		if (b[2] < 0.0001 && b[2] > -0.0001)
			b[2] = 0.000;

		cout << fixed << setprecision(3) << a[2] << b[2] << endl;
	}

	return 0;
}

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

C++: #include<stdio.h>
int main() {
	double a, b, c, d, e, f;
	double x, y, z;
	int i;
	for (i = 0; i < 2; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f);
		z = d / a;
		b *= z;
		c *= z;
		y = (c - f) / (b - e);
		x = (f - e*y) / d;
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}

C++: #include <stdio.h>

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

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

C++: #include <cmath>
#include <cstdio>
#include <cfloat>

namespace
{
	struct equation
	{
		double a, b, c;
	};
	auto calculate_x = [](equation e1, equation e2)
	{
		return (e1.c * e2.b - e1.b * e2.c) / (e1.a * e2.b - e1.b * e2.a);
	};
	auto calculate_y = [](equation e1, equation e2)
	{
		return (e1.c * e2.a - e1.a * e2.c) / (e1.b * e2.a - e1.a * e2.b);
	};
	auto round_off = [](double d, unsigned int digit)
	{
		d *= std::pow(10, digit - 1);
		d = std::round(d);
		d /= std::pow(10, digit - 1);
		return d;
	};
}

namespace
{
	equation e1, e2;
}

int main()
{
	while (std::scanf("%lf", &e1.a) != EOF)
	{
		std::scanf("%lf%lf%lf%lf%lf", &e1.b, &e1.c, &e2.a, &e2.b, &e2.c);
		double x = round_off(calculate_x(e1, e2), 4);
		double y = round_off(calculate_y(e1, e2), 4);
		std::printf("%.3f %.3f\n", x + DBL_EPSILON, y + DBL_EPSILON);
	}
	return 0;
}

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

int main() {
	float a[6];
	float x,y;
	while(true)
		cin >> a[0];
		cin >> a[1];
		cin >> a[2];
		cin >> a[3];
		cin >> a[4];
		cin >> a[5];
		if(cin.eof())
			break;
			
		x = (a[4]*a[2]-a[1]*a[5])/(a[0]*a[4]-a[1]*a[3]);
		y = (-a[3]*a[2]+a[0]*a[5])/(a[0]*a[4]-a[1]*a[3]);
		
		cout.precision(3);
		cout << x << " " << y << endl;
	}
	return 0;
}

C++: import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNextInt()) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int c = scanner.nextInt();
            int d = scanner.nextInt();
            int e = scanner.nextInt();
            int f = scanner.nextInt();

            Equation equation_1 = new Equation(a, b, c);
            Equation equation_2 = new Equation(d, e, f);

            double[] solution = solve(equation_1, equation_2);

            System.out.printf("%.3f %.3f\n", solution[0], solution[1]);
        }
    }

    static double[] solve(Equation left, Equation right) {
        double determinant = left.a * right.b - right.a * left.b;
        double x = (right.b * left.c - left.b * right.c) / determinant;
        double y = (-right.a * left.c + left.a * right.c) / determinant;

        double[] result = { x, y };
        return result;
    }

}

// ax + by = c
class Equation {

    Equation(int a, int b, int c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public int a;
    public int b;
    public int c;

}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

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

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	while (cin >> a >> b >> c >> d >> e >> f) {
		printf("%.3lf %.3lf\n", (e*c-f*b)/(e*a-b*d), (d*c-a*f)/(d*b-a*e));
	}
	
	return 0;
}

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

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

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 ) {
		double x, y;

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

		cout << (x == 0 ? setprecision(3) : setprecision(4)) << showpoint << x;
		cout << " " << (y == 0 ? setprecision(3) : setprecision(4)) << y << endl;
	}
}

C++: #include <iostream>
 
using namespace std;
 
#define EPS 1e-9
 
int main()
{
    int a,b,c,d,e,f;
    float x,y,dx,dy;
    while( cin >> a >> b >>c >>d >> e >> f ) {
        x = (c*e-b*f)/(float)(a*e-b*d);
        y = (c - a*x)/(float)b;
         
 
        printf("%.3f %.3f\n",x+EPS,y+EPS);
    }
 
 
 
    return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <stack>

using namespace std;

int main() {

	int i;
	double no[6] = { 0 }, a, b;

	while (cin >> no[0]) {
	
	for (i = 1; i < 6; i++) {
			cin >> no[i];
		}
		
		a = ((no[2] * no[4]) - (no[1] * no[5])) / ((no[0] * no[4]) - (no[1] * no[3]));
		b = ((no[3] * no[2]) - (no[0] * no[5])) / ((no[1] * no[3]) - (no[0] * no[4]));
		if (a == 0)
			a = 0;
		if (b == 0)
			b = 0;
		
		printf("%.3f %.3f", a, b);
	} 

	return 0;
}