Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func mathRound(f float64) float64 {
	return math.Floor(f + .5)
}

func round(x float64) float64 {
	if math.Abs(x) < 0.001 {
		return 0
	}
	return mathRound(x*1000) / 1000
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		a, err := nextFloat64()
		if err != nil {
			break
		}
		b, _ := nextFloat64()
		c, _ := nextFloat64()
		d, _ := nextFloat64()
		e, _ := nextFloat64()
		f, _ := nextFloat64()

		detA := a*e - b*d
		x := (c*e - b*f) / detA
		y := (a*f - c*d) / detA

		fmt.Printf("%.3f %.3f\n", round(x), round(y))
	}
}

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;
}

C++: #include<stdio.h>
int main(void) {
	int a, b, c, d, e, f, g, h=0;
	while (1)
	{
		scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
		for (double x = -1000; x <= 1000; x++)
		{
			for (double y = -1000; y <= 1000; y++)
			{
				if (a*x + b*y == c&&d*x + e*y == f)
				{
					printf("%.4f %.4f", x, y);
				}
			}
		}
	}

	return 0;
}

C++: #include <iostream>
int main(){
	for(double a,b,c,d,e,f;;){
		std::cin>>a>>b>>c>>d>>e>>f;
		if(std::cin.eof())break;
		double y = (c*d-a*f)>(b*d-a*e)?((c*d-a*f)/((b*d-a*e)*1000))/1000:((c*d-a*f)*1000/(b*d-a*e))/1000;
		double x = (f-e*y)>d?((f-e*y)/(d*1000))/1000:((f-e*y)*1000/d)/1000;
		printf("%0.3lf %0.3lf\n",
		x,
		y);
	}
}

C++: #include<stdio.h>
int main()
{
	double a,b,c,d,e,f,x,y;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF)
	{
		y = (c*d-f*a)/(b*d-a*e);
		x = (c-b*y)/a;
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main( void ) {
    double a, b, c, d, e, f;
    a = 2; b = -1; c = -3; d = 1; e = -1; f = -3;
    double y = ((c*d - a*f) / (b*d - a*e));
    double x = ((c*e - f*b) / (a*e - b*d));
    int iy = (int)(y * 1000);
    int ix = (int)(x * 1000);
    y = iy / 1000.0; x = ix / 1000.0;
    printf("%.3f, %.3f\n", x, y);
    return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include <sstream>
using namespace std;
int main(void){
    double a,b,c,d,e,f,x,y;
    while(cin >> a >> b >> c >> d >> e >> f){
        double ad = a / d;
        d *= ad;
        e *= ad;
        f *= ad;
        d -= a;
        e -= b;
        f -= c;
        y = f/e;
        x = (c - b * y)/a;
        y *= 1000;
        y = round(y);
        y /= 1000;
        x *= 1000;
        x = round(x);
        x /= 1000;
        cout << fixed << std::setprecision(3) << x << " " << fixed <<\???std::setprecision(3) << y << endl;
    }
    return 0;
}