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 <bits/stdc++.h>
using namespace std;

using db = double;

int main() {
	cout << fixed << setprecision(3);
	ios :: sync_with_stdio(false);
	db a, b, c, d, e, f;
	while(cin >> a >> b >> c >> d >> e >> f) {
		db x = (c * e - b * f) / (a * e - b * d);
		db y = (a * f - c * d) / (a * e - b * d);
		cout << x << ' ' << y << '\n';
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
	float a,b,c,d,e,f,x,y;
	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("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

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

float gcd(float &m, float &n) {
	int a, b, t;
	a = (int)m;
	b = (int)n;
	while (1) {
		if (b==0) return (float)a;
		t = b;
		b = a % b;
		a = t;
	}
}

int main() {
	float a, b, c, d, e, f;
	float t, u, v;
	float x, y;
	
	while (1) {
		cin>>a>>b>>c>>d>>e>>f;
		if (cin.eof()) break;

		if ((a<0.0 && d<0.0) || (a>=0.0 && d>=0.0)) {
			t = a * d / gcd(a, d);
			u = t / a;
			b *= u;
			c *= u;
			u = t / d;
			e *= u;
			f *= u;
			y = (c - f)/(b - e);
			x = c - b * y;
		} else if (a<0.0 && d>=0.0) {
			a *= -1;
			b *= -1;
			c *= -1;
			t = a * d / gcd(a, d);
			u = t / a;
			b *= u;
			c *= u;
			u = t / d;
			e *= u;
			f *= u;
			y = (c - f)/(b - e);
			x = c - b * y;
		} else {
			d *= -1;
			e *= -1;
			f *= -1;
			t = a * d / gcd(a, d);
			u = t / a;
			b *= u;
			c *= u;
			u = t / d;
			e *= u;
			f *= u;
			y = (c - f)/(b - e);
			x = c - b * y;
		}

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

C++: #include<stdio.h>

void printFunc(int a,int b,int c,int d,int e,int f);

int main(){
  int a = 0,b = 0,c = 0,d = 0,e = 0,f = 0;

  while(fscanf(stdin,"%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != EOF){
    printFunc(a,b,c,d,e,f);
  }
  
  return 0;
}

void printFunc(int a,int b,int c,int d,int e,int f){
  float ansX,ansY;
  if(b == 0 || e == 0){
    ansY = 0;
  }
  else{
    ansY = (float)(c*d - f*a)/(float)(b*d - e*a);
  }

  if(a == 0 || d == 0){
    ansX = 0;
  }
  else{
    ansX = (float)(c*e - f*b)/(float)(a*e - d*b);
  }

  if(ansX < 0.0005f && ansX > -0.0004f){
    ansX = 0.0f;
  }
  if(ansY < 0.0005f && ansY > -0.0004f){
    ansY = 0.0f;
  }

  printf("%.3f %.3f\n",ansX,ansY);
}

C++: //
//  main.cpp
//  0004
//
//  Created by 竹内 文登 on 13/07/14.
//  Copyright (c) 2013年 竹内 文登. All rights reserved.
//

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    double a,b,c,d,e,f;
    double x,y;
    
    while(cin >> a >> b >> c >> d >> e >> f){
        if(b*d - a*e != 0){
         
         double tmp1 = (c*e - b*f),tmp2 = (a*e - b*d),tmp3 = (c*d - a*f),tmp4=(b*d - a*e);
        tmp1 = tmp1/tmp2;
        tmp2 = tmp3/tmp4;
        x = tmp1;
        y = tmp2;
         printf("%.3f %.3f",x,y);
        }
    }
    return 0;
}

C++: #include<iostream>
int GCM(int a,int b){
	if(b==0)return a;
	return GCM(b,a%b);
}

int main(){
	int a,b,c,d,e,f;
	while(std::cin>>a>>b>>c>>d>>e>>f){
		float x=0.000f,y=0.000f;
		int a_=a,b_=b,c_=c,d_=d,e_=e,f_=f;
		b_*=GCM(a,d)/a,c_*=GCM(a,d)/a;
		e_*=GCM(a,d)/d,f_*=GCM(a,d)/d;
		y=(c_-f_)/(b_-e_);
		x=(c-y*b)/a;
		std::cout<<x<<" "<<y<<std::endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main(void){
	double x1[1000],y1[1000];
	int a=0,b=0,c=0,d=0,e=0,f=0,x2,y2,i=0,j;
    
    while(scanf("%d %d %d %d %d %d\n",&a,&b,&c,&d,&e,&f) != EOF)
	{
		x2 = ((c * e -b * f) / (a * e - b * d))*1000+0.5;
	    y2 = ((c - a * x2) / b)*1000+0.5;

		x1[i] = x2/1000;
		y1[i] = y2/1000;

		i+=1;
	}
	for(j=0;j<i;j++)
	{
		printf("%.3lf %.3lf\n",x1[i],y1[i]);
	}
  return 0;
}

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

int main(){
    float a,b,c,d,e,f;
    while(-1!=scanf("%f%f%f%f%f%f",&a,&b,&c,&d,&e,&f)){
        b/=a;
        c/=a;
        e-=d*b;
        f-=d*c;
        f/=e;
        c-=b*f;

        printf("%.3f %.3f\n", c, f);
    }
    return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#define swap(a,b) {a=a+b; b=a-b; a=a-b;}

void q4() {
	double a, b, c, d, e, f;
	for (;;) {
		cin >> a >> b >> c >> d >> e >> f;
		//scanf_s("%lf %lf %lf %lf %lf %lf\n", &a, &b, &c, &d, &e, &f);

		if (a == 0) {
			swap(a, d);
			swap(b, e);
			swap(c, f);
		}
		b /= a;
		c /= a;
		a = 1;

		e -= b * d;
		f -= c * d;
		d = 0;

		f = f / e;
		e = 1;
		
		c -= f * b;
		b = 0;

		printf("%4lf %4lf\n", c, f);
	}
}

int main() {
	q4();
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <queue>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cmath>
#include <functional>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iterator>
#include <algorithm>
#include <iostream>

#define aLL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXISt(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define MAX 100000000
#define PI 3.14159265258979
#define pb push_back
#define mp make_pair
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };

int sttoi(std::string str) {
	int ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

int gcd(int a, int b){
	if (b > a)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a%b);
}

void solve() {
	int a, b, c, d, e, f;
	double x, y;
	while (scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != -1){
	y = (double)(d*c - a*f) / (double)(b*d - a*e);
	x = (double)(c - b*y) / (double)a;
	x *= 1000;
	y *= 1000;
	x = round(x);
	y = round(y);
	x /= 1000;
	y /= 1000;
	cout << setprecision(8) << fixed << x << " " << y << endl;
	}
}

int main() {
	solve();
	return 0;
}

C++: #include<stdio.h>
int main(void){

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

	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		 
	 
	 if ( (a > 0 && d < 0)|| (a > 0 && d > 0)) {
		A = c*d - f*a;
		B = b*d - e*a;
        y = A / B;
    }
    
    else if ((a < 0 && d > 0) || (a < 0 && d < 0)) {
		A = c*d + f*a;
		B = b*d + e*a;
        y = A / B;
    }
	
    x = (c - y * b) / a;
	printf("%.3lf %.3lf\n" ,x , y);
	}
	return 0;

}

C++: #include <cstdio>

int main() {
	using namespace std;
	for (;;) {
		double a, b, c, d, e, f;
		if (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == EOF) { break; }

		double detA = (double)(a * e - b * d);
		if (detA == 0) { break; }
		double x = (double)(e * c - b * f) / detA;
		if (x <= 0 && x > -5e-4) { x = 0; }
		double y = (double)(-d * c + a * f) / detA;
		if (y <= 0 && y > -5e-4) { y = 0; }
		printf("%.3f %.3f\n", x, y);
	}
	return 0;
}