Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		lcm := lcm(a, d)
		mulA := lcm / a
		mulD := lcm / d
		a *= mulA
		b *= mulA
		c *= mulA
		d *= mulD
		e *= mulD
		f *= mulD

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		y := float64(cF) / float64(bE)
		x := (float64(c) - (y * float64(b))) / float64(a)

		if x == 0 {
			fmt.Printf("%.3f ", 0.0)
		} else {
			fmt.Printf("%.3f ", x)
		}
		if y == 0 {
			fmt.Printf("%.3f\n", 0.0)
		} else {
			fmt.Printf("%.3f\n", y)
		}
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, const char * argv[])
{
    double a=0.0;
    double b=0.0;
    double c=0.0;
    double d=0.0;
    double e=0.0;
    double f=0.0;
    double x=0.0;
    double y=0.0;
    int end=0;
    
    while(scanf("%d",&end)!=EOF){
        a=end;
        scanf("%lf",&b);
        scanf("%lf",&c);
        scanf("%lf",&d);
        scanf("%lf",&e);
        scanf("%lf",&f);
        
        y = (d*c-a*f)/(d*b-a*e);
        x = (c-b*y)/a;
        
        printf("%.3lf",x);
        printf(" ");
        printf("%.3lf\n",y);
        
    }
    
}

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

int main(){
	double a, b, c, d, e, f;
	double x, y;
	double A, B, C;
	const double p = 0.00000001;

	while (cin >> a >> b >> c >> d >> e >> f){
		A = (a*e) - (b*d);
		B = (c*e) - (b*f);
		C = (a*f) - (c*d);

		x = B / A;
		y = C / A;
		
		if (abs(x) < p) x = 0;
		if (abs(y) < p) y = 0;

		printf("%.3lf %.3lf\n", x, y);
	}
	
	return 0;
}

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

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

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;

int main()
{
	double 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)x = fabs(x);
		if (y == 0)y = fabs(y);
		cout << fixed << setprecision(3) << x << " ";
		cout << fixed << setprecision(3) << y << endl;
	}
	return 0;
}

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

using namespace std;

int main (void) {
    int a, b, c, d, e, f;
    double x, y;
    while (1) {
        cin >> a;
        cin >> b;
        cin >> c;
        cin >> d;
        cin >> e;
        cin >> f;
        if (cin.eof()) break;
        x = (double)(c * e - b * f) / (double)(a * e - b * d);
        y = (double)(c * d - a * f) / (double)(b * d - a * e);
        cout << fixed << setprecision(3) << x << endl;
        cout << fixed << setprecision(3) << y << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  double a, b, c, d, e, f;
  while(cin >> a >> b >> c >> d >> e >> f){
    double aa = a * d, bb = b * d, cc = c * d;
    double ee = e * a, ff = f * a;
    double y = (cc - ff) / (bb - ee);
    double x = (cc - bb * y) / aa;

    printf("%0.3f %0.3f\n", x, y);
  }
  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=(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;
    cout <<fixed<<setprecision(3)<< x <<" "<< y <<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    double a, b, c, d, e, f;
    cout << fixed << setprecision(3);
    while(cin >> a >> b >> c >> d >> e >> f){
        if(a != 0){
            if(a != 1){
                b = b / a;
                c = c / a;
                a = a / a;
            }
            e = e - b * d / a;
            f = f - c * d / a;
            d = d - d / a;
            if(e != 1){
                f = f / e;
                e = e / e;
            }
            c = c - f * b / e;
            b = b - b / e;
        }
        cout << c << " " << f << endl;
    }
    
    return 0;
}

C++: File Edit Options Buffers Tools C++ Help                                           
#include <iostream>
#include <iomanip>
#include <cmath>


using namespace std;
#define RENT 100000

int main(){
  int n;
  int cnt=0;

  float a, b, c, d, e, f;
  while(cin >> a >> b >> c >> d >> e >> f){

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

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

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

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

C++: /* AOJ0004 */
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
  // むずすぎぃ
  double a, b, c, d, e, f;
  while( cin >> a >> b >> c >> d >> e >> f){
    double y = ( a * f - c * d) / ( a * e - b * d);
    double x = ( c - b * y ) / a;
    cout << fixed << setprecision(3) << x << " " << y << endl;
  }
  return 0;
}

C++: import java.io.*;
import java.text.DecimalFormat;
class Main{

    public static void main(String[] args)throws IOException{
	BufferedReader br =new BufferedReader(new  InputStreamReader(System.in));
	String buf;
	double[][] data=new double[2][3];
	double x,y;
	while((buf=br.readLine()) != null){
	    String[] buf2=buf.split(" ");
	    for(int i=0;i<data.length;i++){
		for(int j=0;j<data[i].length;j++){
		    data[i][j]=Double.parseDouble(buf2[i*3+j]);
		}
	    }
	    double a,b,c,d;
	    a=(data[0][2] * data[1][1] - data[0][1] * data[1][2]);
	    b=(data[0][0] * data[1][1] - data[1][0] * data[0][1]);
	    c=(data[0][2] * data[1][0] - data[1][2] * data[0][0]);
	    System.out.println(c);
	    d=(data[0][1] * data[1][0] - data[0][0] * data[1][1]);
	    System.out.println(d);
	    x = a / b;
	    y = c / d;
	    DecimalFormat decimalFormat1 = new DecimalFormat("#.000");
	    System.out.print(decimalFormat1.format(x));
	    System.out.print("\t");
	    System.out.println(decimalFormat1.format(y));
	}
    }
}

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

int main() {
	int a, b, c, d, e, f;
	int cnt = 0;
	bool flg = true;
	std::vector<double> x_vector;
	std::vector<double> y_vector;

	while (cin >> a >> b >> c >> d >> e >> f) {
		double x = (b * f - c * e) / (b * d - a * e);
		double y = (c * d - a * f) / (b * d - a * e);

		cnt++;
		x_vector.push_back(x);
		y_vector.push_back(y);
	}

	for (unsigned int i = 0; i < cnt; i++) {
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x_vector[i] << " ";
		std::cout << std::setprecision(3) << y_vector[i] << endl;
	}

	return 0;
}