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

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

C++: #include <stdio.h>
double round3(double a){
	a=a*10000;
	if(int(a)%10>5)a=a+10-int(a)%10;
	a=double (int (a/10));
	a=a/10000;
	return a;
}

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

C++: #include <stdio.h>

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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(3);
    double a1, b1, c1, a2, b2, c2;
    while(cin>>a1>>b1>>c1>>a2>>b2>>c2){
        double m = a1*b2-a2*b1;
        double x=(c1*b2-c2*b1)/m, y=(a1*c2-a2*c1)/m;
        if(fabs(x)<1e-9) x=0;
        if(fabs(y)<1e-9) y=0;
        cout<<x<<' '<<y<<'\n';
    }
    return 0;
}

C++: #include<stdio.h>

int main(void)
{
	int a,b,c,d,e,f,t=0,n,cx,cy;
	double x[100]={0},y[100]={0};
	
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF)
	{
		x[t]=(c*e-b*f)/(a*e-b*d)+0.0;
		y[t]=(d*c-a*f)/(b*d-a*e)+0.0;
		t++;
	}

	for(n=0;n<t;n++)
	{
		printf("%.3lf %.3lf\n",x[n],y[n]);
	}
	return 0;
}

C++: #include "iostream"
#include "iomanip"
using namespace std;

int main()
{
	double a,b,c,d,e,f,x,y;
	for(int i=0;i<2;i++)
	{
		cin>>a>>b>>c>>d>>e>>f;
		y=(a*f-c*d)/(a*e-b*d);
		x=(c*e-b*f)/(a*e-b*d);
		cout<<fixed<<setprecision(3)<<x<<" "<<y<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
	int a,b,c,d,e,f;
	int o,p,q,r,s,t;
	float x,y;
	while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)!=EOF){
		o=a;p=b;q=c;r=d;s=e;t=f;
		o*=d;p*=d;q*=d;
		r*=a;s*=a;t*=a;
		//printf("%d %d %d %d %d %d \n",o,p,q,r,s,t);
		p-=s;
		q-=t;
		if(q==0){
			y=0;
		}
		else{
		y=(float)(q/p);
		}
		int g=(int)(e*y);
		g*=-1;
		if(f+g==0){
			x=0;
		}
		else{
			x=(float)((f+g)/d);
		}
		printf("%.3f %.3f\n",x,y);
	}
}

C++: #include<iostream>


using namespace std;

int main()
{
 double a,b,c,d,e,f;
 double n;
 double x,y,ty,tc;
	while( cin>>a>>b>>c>>d>>e>>f )
	{
 	n=(a/d);
 	d = d * n;
 	e = e * n;
 	f = f * n;

	ty = b-e; 	
 	tc = c-f;
 	y = tc/ty;

 	tc = c - (b*y);
 	x = tc/a;
 	
 printf("%0.3f %0.3lf",x,y);
 	
	}
 
}

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

using namespace std;

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


double x(double, double, double, double, double, double) {

	return (c*e - b*f) / (a*e - b*d);
}

double y(double, double, double, double, double, double) {

	return (a*f - c*d) / (a*e - b*d);
}

double round(double dat, int keta ){

	int fct;
	fct =  double pow(10, keta - 1);
	dat *= fct;
	dat += (dat < 0) ? -0.5 : 0.5;
	dat = (int)(dat);
	dat /= fct;
	return dat;
}

int main()
{
	double x1, x2, y1, y2;
	cin >> a >> b >> c >> d >> e >> f;

	x1 = x(a, b, c, d, e, f);
	y1 = y(a, b, c, d, e, f);

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

	x2 = x(a, b, c, d, e, f);
	y2 = y(a, b, c, d, e, f);

	cout << fixed << setprecision(3) << round(x1,3) << " " << round(y1,3) << endl;
	cout << fixed << setprecision(3) << round(x2,3) << " " << round(y2,3) << endl;

	return 0;
}

C++: #include <stdio.h>
#include<string>
#include<string.h>
#include <math.h>
#include<iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
using namespace  std;


/*
//my header
#include "define.h"
#include "geometry.h"*/


void init()
{
#ifdef _WIN32
	freopen("1.txt", "r", stdin);
#endif
}

void func();

int main()
{
	init();
	func();

	return 0;
}
#define MyAbs(a) ((a)>0?(a):-(a))
#define MyEqualDoule(a,b) (MyAbs(a,b)<1e-6)

void func()
{
	double a,b,c,d,e,f, x, y;
	while(~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f))
	{
		if(MyEqualDoule(a*e-b*d,0))
			x = 0;
		else
			x = (c*e-f*b)/(a*e - b*d);

		if(MyEqualDoule(b*d - a*e),0)
			y = 0;
		else
			y = (c*d-a*f)/(b*d - a*e);
		printf("%.3lf %.3lf\n", x, y);
	}
}

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

int main()
{ 
	double x1, x2, y1, y2, z1, z2;
	double x, y;
	int i = 0;
	while (cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2&&i<2) {
		x = x1;
		x1 *= x2; y1 *= x2; z1 *= x2;
		x2 *= x; y2 *= x; z2 *= x;
		y = (z1 - z2) / (y1 - y2);
		if (z1 - z2 == 0)y = 0;
		x = (z1 - (y1*y)) / x1;
		if (z1 - (y1*y) == 0)x = 0;
		int a, b;
		a = x * 10000;
		b = y * 10000;
		if (a % 10 > 4) {
			a += 10;
			x = double(a) / 10000;
		}
		if (b % 10 > 4) {
			b += 100;
			y = double(b) / 10000;
		}
		cout << fixed;
		cout << setprecision(3) << x << ' ' << y << endl;
		i++;

	}
	return 0;
}

C++: #include<stdio.h>
int main() {
	double a, b, c, d, e, f;
	double x, y, z;
	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<cmath>
#include<iostream>

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

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

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

C++: #include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
int a, b, c, d, e, f;

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

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

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

C++: #include <bits/stdc++.h>
using namespace std;
double a,b,c,d,e,f,y,x;

int main (){
	while(cin>>a>>b>>c>>d>>e>>f){
		y=(((c*d)-(f*a))/((b*d)-(e*a)));
		x=((c*d)-(b*y*d))/(a*d);
		if(x==0){
			x=abs(x);
		}
		if(y==0){
			y=abs(y);
		}
		cout<<fixed<<showpoint<<setprecision(3);
		cout<<x<<" "<<y<<endl;
	}
}