Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var a, b, c, d, e, f float64
        sc := bufio.NewScanner(os.Stdin)
        for sc.Scan() {
                fmt.Sscanf(sc.Text(), "%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)

                det := a*e - b*d
                x := (e*c - b*f) / det
                y := (a*f - c*d) / det
                fmt.Printf("%04f %04f\n", x, y)
        }
}

C++: #include<cstdio>
#include<cmath>
#include<utility>
using namespace std;
pair<double,double> solve(double *a){
    double x,y;
    if(a[0]==0){
        y=a[2]/a[1];
        x=(a[5]-a[4]*y)/a[3];
    }else if(a[1]==0){
        x=a[2]/a[0];
        y=(a[5]-a[3]*x)/a[4];
    }else if(a[3]==0){
        y=a[5]/a[4];
        x=(a[2]-a[1]*y)/a[0];
    }else if(a[4]==0){
        x=a[5]/a[3];
        y=(a[2]-a[0]*x)/a[1];
    }else{
        y=(a[2]-(a[5]*(a[0]/a[3])))/(a[1]-(a[4]*(a[0]/a[3])));
        x=(a[2]-a[1]*y)/a[0];
    }
    return make_pair(x,y);
}
int main(){
    double a[6];
    for(;;){
        for(int i=0;i<6;i++){
            if(scanf("%lf",&a[i])==-1)return 0;
        }
        pair<double,double> ans=solve(a);
        printf("%.3lf %.3lf\n",rint(ans.first*1000)/1000.0,rint(ans.second*1000)/1000.0);
    }
}

C++: #include <iostream> 
using namespace std;
const int n = 1000, m = 1000, j = 1000, h = 1000, k = 1000, l = 1000, q = 1000, w = 1000;
double a[n], b[m], c[j], d[h], e[k], f[l];
double x[q], y[w]; 
int main () {
	for (int i = 1; i<= 2; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i] >> e[i] >> f[i];
	}

	for (int i = 1; i<= 2; i++) {
		x[i] = (c[i] * e[i] - b[i] * f[i]) / (a[i] * e[i] - b[i] * d[i]);
		y[i] = (a[i] * f[i] - c[i] * d[i]) / (a[i] * e[i] - b[i] * d[i]);
		printf ("%.3f %.3f", x[i], y[i]);
		cout << endl;
	}
	
	return 0;
}

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

#define MAX 256

int main(void){

	float a, b, c, d, e, f;
	float ansx[MAX], ansy[MAX];

	int i = 0;

	while (scanf("%f%f%f%f%f%f%f", &a,&b,&c,&d,&e,&f) != EOF){
		if (a*e != b*d){
			ansx[i] = (c*e - b*f) / (a*e - b*d);
			ansy[i] = (c*d - a*f) / (b*d - a*e);
			if (((int)(ansx[i] * 10000) % 10) > 4){
				ansx[i] += 0.001;
			}
			if (((int)(ansy[i] * 10000) % 10) > 4){
				ansy[i] += 0.001;
			}
		}
		i++;
	}

	for (int j = 0; j < i; j++){
		printf("%.3f %.3f\n", ansx[j], ansy[j]);
	}
	
	return 0;
}

C++: #include<iostream>
#include<sstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<numeric>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;
typedef map<string,int> dict;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
double eps = 1e-10 ;

template <typename T>
void out(vector < T > v)
{
  for(size_t i = 0; i < v.size(); i++)
  {
    debug(v[i]);
  }
}

template<typename T>
string ntos( T i ) {
  ostringstream s ;
  s << i ;
  return s.str() ;
}

template<typename T>
T ston(string str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,c,d,e,f,x,y;
  while(cin >> a >> b >> c >> d >> e >> f){
    x = (b*f-e*c)/(b*d-e*a) * 1000 ;
    if(x > 0){
      x += 0.5 ;
    }
    else if(x < 0){
      x -= 0.5 ;
    }
    x = (double)((int)(x))/1000.0 ;
    y = (c*d-a*f)/(b*d-e*a) * 1000 ;
    if(y > 0){
      y += 0.5 ;
    }
    else if(y < 0){
      y -= 0.5 ;
    }
    y =(double)((int)(y))/1000 ;
    cout << x << " " << y << endl;
  }
  return 0;
}

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

int main(){
	double a,b,c,d,e,f,det;
	double x,y;
	//cout << "Input the number: ";
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cin >> f;
	det = a*e-b*d;
//	if(det == 0) cout << "No answer" << endl;
	x = (1.0/det)*(e*c-b*f);
	y = (1.0/det)*(a*f-d*c);
//	cout << "x:" << x << " y:" << y << endl;
	cout << x << " " << y << endl;
	return 0;
}

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

int main(){
	float a,b,c,d,e,f,x,y;
	while(scanf("%f",&a)){
	scanf("%f%f%f%f%f",&b,&c,&d,&e,&f);
	x=(c*e-b*f)/(a*e-b*d);
	y=(c*d-a*f)/(b*d-a*e);
	if(x>-0.0005&&x<=0.0005){
		x=0;
	}
	if(y>-0.0005&&y<=0.0005){
		y=0;
	}
	printf("%.3f %.3f",x,y);
	std::cout<<std::endl;
	}
	return 0;
	}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    double a,b,c,d,e,f;
        while(cin>>a>>b>>c>>d>>e>>f){
        double x = (c*e-b*f)*(1/(a*e-b*d));
        double y = (-c*d+a*f)*(1/(a*e-b*d));
        char buf[24], buff[24];
        snprintf(buf, 24, "%.3f", x);
        snprintf(buff, 24, "%.3f", y);
        if(!strcmp(buf ,"-0.000"))strcpy(buf, "0.000");
        if(!strcmp(buff ,"-0.000"))strcpy(buff, "0.000");
        if(x==0)x=0;
        printf("%s %s\n",buf,buff);
    }
}

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", round(x * 1000.0) / 1000.0, round(y * 1000.0) / 1000.0);
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>

#define doubled( x ) (x * x)

//?????????????¨????(2 * 2??£?????????)
int matrix_val(int a11, int a12, int a21, int a22);

//?????°?????°?????? (in:??´??° out:?????°)
int digit_count(int num);

using namespace std;

int main()
{
	int a, b, c, d, e, f;
	
	cin >> a >> b >> c ;
	cin >> d >> e >> f;
	do
	{
		int ans_x = matrix_val(c, b, f, e) / matrix_val(a, b, d, e);
		int ans_y = matrix_val(a, c, d, f) / matrix_val(a, b, d, e);
		
		cout << ans_x << ans_y << endl;
	}while( (cin >> a >> b >> c >> d >> e >> f) );
	
	return 0;
}

int matrix_val(
int a11, int a12,
int a21, int a22
){
	return ((a11 * a22) - (a12 * a21));
}

int digit_count(int num)
{
	if( num < 0 )num *= (-1);
	
	int count = 0;
	
	for(int i = 10; num != 0; i *= 10)
	{
		int diff = num % i;
		num -= diff;
		count++;
	}
		
	return count;
}

C++: #include <cmath>
#include <iomanip>
#include <ios>
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int main()
{
    string s;
    while (getline(cin, s)) {
        stringstream ss;
        ss << s;
        int a, b, c, d, e, f;
        ss >> a >> b >> c >> d >> e >> f;

        auto det = [](int a00, int a01, int a10, int a11) -> double {
            return a00 * a11 - a01 * a10;
        };

        auto x1 = round(det(c, b, f, e) / det(a, b, d, e) * 1000.0) / 1000.0;
        auto x2 = round(det(a, c, d, f) / det(a, b, d, e) * 1000.0) / 1000.0;
        if (x1 == 0.0) {
            x1 = 0.0;
        }
        if (x2 == 0.0) {
            x2 = 0.0;
        }
        //stringstream tmp;
        //tmp << setprecision(4) << fixed << x1 << ' ' << x2 << endl;
        //double o1, o2;
        //tmp >> o1 >> o2;
        cout << setprecision(4) << fixed << x1 << ' ' << x2 << endl;
    }
}