Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanLines)
	for sc.Scan() {
		s := strings.Split(sc.Text(), " ")
		a, _ := strconv.ParseFloat(s[0], 64)
		b, _ := strconv.ParseFloat(s[1], 64)
		c, _ := strconv.ParseFloat(s[2], 64)
		d, _ := strconv.ParseFloat(s[3], 64)
		e, _ := strconv.ParseFloat(s[4], 64)
		f, _ := strconv.ParseFloat(s[5], 64)
		x := ((b * f) - (c * e)) / ((b * d) - (a * e))
		y := ((a * f) - (c * d)) / ((a * e) - (b * d))
		if x == 0 {
			fmt.Printf("0.000 %.3f\n", y)
		} else if y == 0 {
			fmt.Printf("%.3f 0.000\n", x)
		} else {
			fmt.Printf("%.3f %.3f\n", x, y)
		}
	}
}

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

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

  while( cin >> a >> b >> c >> d >> e >> f ) {
    det = a*e-b*d;
    float x = (c*e-f*b)/det;
    float y = (-c*d+f*a)/det;
    x = (x==-0.0)?0.0:x;  // Convert -0.0 to 0.0
    y = (y==-0.0)?0.0:y;
    cout << setiosflags(ios::fixed) << setprecision(3);
    cout << x << " " << y << endl;
  }

  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 {
		A = c*d + f*a;
		B = b*d + e*a;
        y = A / B;
    }


    x = (c - y * b) / a;
	printf("%.3f %.3f\n" ,x , y);
	}
	return 0;

}

C++:  /*
Write a program which solve a simultaneous equation:

        ax + by = c
        dx + ey = f
The program should print x and y for given a, b, c, d, e and f(-1000 &#8804; a, b, c, d, e, f &#8804; 1000). You can suppose that given equation has a unique solution.
 */

#include <iostream>
#include <cstdio>

using namespace std;

void solve(int a, int b, int c, int d, int e, int f) {
	double x = (f - (double)e*c/b) / (d - (double)e*a/b);
	double y = (c - a*x) / b;
	if (x == 0) x = 0.000;
	if (y == 0) y = 0.000;
	printf("%4.3f %4.3f\n", x, y);
}

int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		solve(a,b,c,d,e,f);
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main(){
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f){
        double M[2][3] = { 
            {a, b, c},
            {d, e, f}
        };
        double d = 0, m = 0;
        for(int i=0; i<2; ++i)
        {  
            d = M[i][i];
            for(int j=0; j<3; ++j){
                M[i][j] = M[i][j] / d;
            }
            for(int k = i+1; k<2; k++){
                m = M[k][i];
                for(int n = i; n<3; ++n){
                    M[k][n] = M[k][n] - m * M[i][n];
                }
            }
        }
        
        for(int i = 1; i>0; --i){
            for(int j= i-1; j>=0; --j){
                d = M[j][i];
                for(int n=i; n<3; ++n){
                    M[j][n] = M[j][n] - d * M[i][n];
                }
            }
        }
        for(int i=0; i<2; i++){
            if(i == 1) {
                cout << M[i][2] << endl; break;
            }
            cout << fixed << M[i][2] << " ";
            
        }
    }
    return 0;
}

C++: #include <stdio.h>

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){
		x = ((double)e*(double)c-(double)b*(double)f)/((double)e*(double)a-(double)b*d);
		y = ((double)d*(double)c-(double)a*(double)f)/((double)b*(double)d-(double)a*e);
		printf("%.3f %.3f\n", x, y);
	}
}

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

C++: #include <cstdio>
#include <stdlib.h>
#include <math.h>

float a,b,c,d,e,f;
double    round( double val, int precision )
{
    double    ret;
    char    buf[256] = {'\0'};
    char    *p;

    sprintf( buf, "%.*f", precision, val );
    ret = strtod( buf, &p );

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

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	double a, b, c, d, e, f;
	for (; cin >> a >> b >> c >> d >> e >> f;)
	{
		double x, y;
		if (a == 0 || b == 0 || d == 0 || e == 0)
		{
			if (a == 0)
			{
				y = c / b;
				x = (f - e * y) / d;
			}
			else if (b == 0)
			{
				x = c / a;
				y = (f - d * x) / e;
			}

			if (d == 0)
			{
				y = f / e;
				x = (c - b * y) / a;
			}
			else if (e == 0)
			{
				x = f / d;
				y = (c - a * x) / b;
			}
		}
		else
		{
			double a0 = a * e;
			double c0 = c * e;

			double d0 = d * b;
			double f0 = f * b;

			x = (f0 - c0) / (d0 - a0);

			y = (c - a * x) / b;
		}

		if (x == 0)
		{
			x = abs(x);
		}
		if (y == 0)
		{
			y = abs(y);
		}

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

	}
}

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

double get(double a){
    if(abs(a) < 1e-9)return 0;
    return a;
}

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

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

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

	std::cout << std::fixed << std::setprecision(3);
	while (std::cin >> a >> 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) x = 0;
		if (y == -0) y = 0;
		std::cout << x << " " << y << std::endl;
	}

	return 0;
}

C++: #include <iostream>
#include<stdio.h>
int main(){
	long double a, b, c, d, e, f,x,y;
	while (std::cin >> a >> b >> c >> d >> e >> f) {
		x = (b*f - e * c) / (d*b - a * e);
		y = (a*f - d * c) / (a*e - d * b);
		if (x < 0)
			x = (double)((int)(1000 * x - 0.5)) / 1000;
		else
			x = (double)((int)(1000 * x + 0.5)) / 1000;
		if (y < 0)
			y = (double)((int)(1000 * y - 0.5)) / 1000;
		else
			y = (double)((int)(1000 * y + 0.5)) / 1000;
		printf("%.3llf %.3llf\n", x, y);
	}
	return 0;
}