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("%.3f %.3f\n", x, y)
        }
}

C++: // ------------------------------------
// Date:2018/ 2/13
// Problem:0004 : SimulataneousEquation 4.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define REP(i,n) FOR(i,0,n)

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

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

int main(){
	double a, b, c, d, e, f;
	while(std::cin >> a){
		std::cin >> b >> c >> d >> e >> f;
		std::cout << std::fixed << std::setprecision(3)
			<< floor((c * e - b * f) / (a * e - b * d) + 0.0005) << ' '
			<< floor((a * f - c * d) / (a * e - b * d) + 0.0005) << std::endl;
	}
	return 0;
}

C++: #include <cstdio>

int main(){
	int arr[10][10],p,q;
	float h[5];

	while(scanf("%d %d %d %d %d %d",&arr[1][1],&arr[1][2],&arr[1][3],&arr[2][1],&arr[2][2],&arr[2][3])!=EOF){
		//printf("%d %d %d %d %d %d \n",arr[1][1],arr[1][2],arr[1][3],arr[2][1],arr[2][2],arr[2][3]);
		if(arr[1][1] < 0){
			for(int k = 1;k<4;k++){
				arr[1][k] = arr[1][k]*(-1);
			}
		}

		if(arr[2][1] < 0){
			for(int l = 1;l<4;l++){
				arr[2][l] = arr[2][l]*(-1);
			}
		}

		for(int i = 4;i<7;i++){
			arr[1][i] = arr[1][i-3]*arr[2][1];
			arr[2][i] = arr[2][i-3]*arr[1][1];
		}

		p = arr[1][5]-arr[2][5];
		q = arr[1][6]-arr[2][6];

		h[2] = q/p;

		h[1] = (arr[1][3]-(arr[1][2]*h[2]))/arr[1][1];

		printf("%.3f %.3f\n", h[1],h[2]);
	}
}

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

/*
ax + by = c
dx + ey = f

x = (c-by)/a
d(c-by)/a + ey = f
dc/a - dby/a + ey = f
ey - dby/a = f - dc/a
y(e-db/a) = f - dc/a
y = (f-dc/a)/(e-db/a)

aex + bey = ce
bdx + bey = bf
aex - bdx = ce - bf
x(ae - bd) = ce - bf
x = (ce - bf)/(ae - bd)
by = c - ax
y = (c - ax)/b
*/
int main()
{
    while(true){
        double a, b, c, d, e, f;
        std::cin >> a >> b >> c >> d >> e >> f;
        if(std::cin.eof()) break;
        double x, y;
        // if(b){
            x = (c*e - b*f) / (a*e - b*d);
            y = (c - a*x) / b;
        // }else{
        //     y = (f-d*c/a)/(e-d*b/a);
        //     x = (c-b*y)/a;
        // }
        if(x == -0) x = 0;
        if(y == -0) y = 0;
        std::cout << std::fixed << std::setprecision(3);
        std::cout << x << " " << y << std::endl;
    }
    return 0;
}

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

int main()
{
    // your code goes here
    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 - a * x) / b;
        if(x<-0.0001){
            x=0;
        }
        if(y<-0.0001){
            y=0;
        }
        printf("%.3lf %3lf\n", x, y);
    }
    return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
/*
 * 
   1  2  3  4  5  6
   2 -1 -2 -1 -1 -5  
 * 
 */
int main()
{
    double a,b,c,d,e,f;
    while(std::cin >> a >> b >> c >> d >> e >> f) 
    {
        double y = ( (c / a) - (f / d) ) / ( (b / a) - (e /d ));
        double x = ( c / a ) - ( b / a ) * y;
        printf("%.3lf %.3lf",x,y);
    }  
    return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#define REP(i, n) for(i = 0; i < n; i++)
const int n = 2;
int main()
{
    double a, b, c, d, e, f;
    int i, j;
    while(std::cin >> a >> b >> c >> d >> e >> f)
    {
        double A[n][n + 1] {
            {a, b, c},
            {d, e, f}
        };
        REP(i, 3) A[0][i] /= a;
        REP(i, 3) A[1][i] -= d * A[0][i];
        double d1 = A[1][1];
        REP(i, 3) A[1][i] /= d1;
        REP(i, 2) REP(j, 3)
        {
            int roundtmp = 1000;
            A[i][j] *= roundtmp;
            A[i][j] = int(A[i][j] + 0.5 - (A[i][j] < 0));
            A[i][j] /= roundtmp;
        }
        std::cout.precision(4);
        std::cout << std::showpoint << A[0][2] - A[0][1] * A[1][2] << " " << A[1][2] << std::endl;
    }
}

C++: #include <cstdio>
using namespace std;
double eps=1e-9;
int main(){
	double a,b,c,d,e,f;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF) printf("%.3f %.3f\n",(c*e-b*f)/(a*e-b*d)+eps,(a*f-c*d)/(a*e-b*d)+eps);
	return 0;
}

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

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

C++: #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
#define EPS (5.0e-4)

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

C++: #include<stdio.h>
int main(void)
{
	float e2,f2,c2;
	float a1,b1,c1,d1,e1,f1;
	float a,b,c,d,e,f;
	float add,x,y;
	while(scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f)!=EOF){
		add=a/d;
		a1=a;
		b1=b;
		c1=c;
		d1=d*add;
		e1=e*add;
		f1=f*add;
		e2=b-e1;
		f2=c-f1;
		y=f2/e2;
		add=b/e;
		a1=a;
		b1=b;
		c1=c;
		d1=d*add;
		e1=e*add;
		f1=f*add;
		a1=a-d;
		c2=c-f1;
		x=c2/a1;
		printf("%f %f\n",x,y);
	}
	return 0;
}
/*
1x+2y=3
4x+5y=6
a  b  c
1x+2y=3;
1.6x+2y=1.2
d    e   f
-0.4x=1.8
*/

C++: #include <stdio.h>

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

	while(1){
		if(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != 6){
			break;
		}

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

		printf("%.3f %.3f\n", x, y);
	}

	return 0;
}