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++: #include<iostream>
#include<iomanip>
using namespace std;

int main(){
	double a11,a12,c,a21,a22,f;
	while(cin>>a11>>a12>>c>>a21>>a22>>f){
		double x,y,delta=((double)a11*a22-(double)a12*a21);
		x=((double)a22*c-(double)a12*f)/delta;
		y=((double)a11*f-(double)c*a21)/delta;
		if(x>0){x=(double)(((int)((x*1000)+0.5))/1000);
		}else if{x=(double)(((int)((x*1000)-0.5))/1000);}else{x=0;}
		if(y>0){y=(double)(((int)((y*1000)+0.5))/1000);
		}else if{y=(double)(((int)((y*1000)-0.5))/1000);}else{y=0;}
		cout<<fixed<<setprecision(3)<<x<<" "<<y<<endl;
	}
	return 0;
}

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

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

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

  m = a;
  n = d; 

  a *= n;
  b *= n;
  c *= n;

  d *= m;
  e *= m;
  f *= m;
  
  y = (c-f)/(b-e);

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

  if(x==-0)
    x*=-1;
  if(y==-0)
    y*=-1;

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

  return 0;
}

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

int main() {
	double a, b, c, d, e, f;
	vector<double> x, y;
	while (cin >> a) {
		double tmpY;
		cin >> b >> c >> d >> e >> f;
		if (a*e != b*d) {
			y.push_back((c*d - a*f) / (b*d - a*e));
			tmpY = (c*d - a*f) / (b*d - a*e);
		} else {
			continue;
		}
		if (a != 0) {
			x.push_back((c - b*tmpY) / a);
		} else if (d != 0) {
			x.push_back((f - e*tmpY) / d);
		} else {
			continue;
		}
	}

	for (int i = 0; i < x.size(); i++) {
		cout << fixed << setprecision(3) << x[i] << " " << y[i] << endl;
	}
}

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

using namespace std;

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

	cin >> a >> b >> c >> d >> e >> f;

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

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

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

#define add push_back
#define inf 2147000000

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(void){
	float a,b,c,d,e,f,g,h,i,x,y;
	
	while(scanf("%lf",&a)!=EOF){
		scanf("%lf%lf%lf%lf%lf",&b,&c,&d,&e,&f);
		
		
		g=a/d;
		d*=g;
		e*=g;
		f*=g;
		
		h=b-e;
		i=c-f;
		
		x=i/h;
		h=a;
		i=c-b*x;
		y=i/h;
		
		printf("%.3lf %.3lf\n",y,x);
	}
}

C++: #include <stdio.h>

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

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

using namespace std;

typedef struct Shiki{
  double a,b,c;//ax+by=c
  double x,y;
};

Shiki Equation (Shiki, Shiki);

main(){
  Shiki shiki1,shiki2;
  vector<Shiki> ans;
  int i=0;
  
  while(cin){

    cin>>shiki1.a>>shiki1.b>>shiki1.c>>shiki2.a>>shiki2.b>>shiki2.c;
    ans.push_back(Equation(shiki1,shiki2));
    i++;
    
  }
  cout<<"hogee"<<endl;
  for(int j=0;j<i;j++){
    cout<< fixed << setprecision(4) << ans[j].x << " " << ans[j].y << endl; 
  }
}

Shiki Equation (Shiki A, Shiki B){
  Shiki ans,preA;
  int x,y,aa,ba;
  
  preA = A;

  aa = A.a;
  ba = B.a;
  
  A.a *= ba;
  A.b *= ba;
  A.c *= ba;
  
  B.a *= aa;
  B.b *= aa;
  B.c *= aa;
  
  ans.a = 0;
  ans.b = A.b - B.b;
  ans.c = A.c - B.c;
  ans.y = ans.c / ans.b;
  ans.x = (preA.c - preA.b*ans.y)/preA.a;
  
  if((ans.y*1000)%10 >= 5)ans.y += 0.0001;
  if((ans.y*1000)%10 >= 5)ans.x += 0.0001;
  
  return ans;
}

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

int main(int argc, char const *argv[]){
	
	double a,b,c,d,e,f;
	std::vector<double> solution_x;
	std::vector<double> solution_y;

	while(std::cin >> a >> b >> c >> d >> e >> f){
		double x = (c*e-b*f)/(a*e-b*d);
		double y = (a*f-c*d)/(a*e-b*d);
		solution_x.push_back(x);
		solution_y.push_back(y);
	}

	for (int i = 0; i < solution_x.size(); ++i){
		std::cout << std::fixed;
		std::cout << std::setprecision(3);
		std::cout << solution_x[i] << " " << solution_y[i] << std::endl;
	}

	return 0;
}

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

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

C++: #include<iostream>
using namespace std;
 
int main()
{
    double a,b,c,d,e,f;
    while(cin>>a>>b>>c>>d>>e>>f){
        printf("%.3f ",(c-b*(f-d*c/a)/(e-d*b/a))/a);
        printf("%.3f\n",(f-d*c/a)/(e-d*b/a));
    }
    return 0;
}

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

C++: #include<cstdio>
int main(){
	int a[2][2],b[2];
	float a_inverse[2][2];
	float answer[2];
	while(scanf("%d %d %d %d %d %d",&a[0][0],&a[0][1],&b[0],&a[1][0],&a[1][1],&b[1]) != EOF){
		float delta = a[0][0] * a[1][1] - a[1][0] * a[0][1];
		a_inverse[0][0] = a[1][1] / delta;
		a_inverse[1][1] = a[0][0] / delta;
		a_inverse[0][1] = -a[0][1] / delta;
		a_inverse[1][0] = -a[1][0] / delta;
		answer[0] = a_inverse[0][0] * b[0] + a_inverse[0][1] * b[1];
		answer[1] = a_inverse[1][0] * b[0] + a_inverse[1][1] * b[1];
		printf("%.3f %.3f\n",answer[0],answer[1]);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	//Cramer's Rule
	double a, b, c, d, e, f;

	while(cin >> a >> b >> c >> d >> e>> f) {
		printf("%.3f %.3f\n", (e * c - b * f) / (a * e - b * d), (a * f - c * d) / (a * e - b * d));
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
define swap(a,b) {a=a+b; b=a-b; a=a-b;}

using namespace std;

void q4() {
	double a, b, c, d, e, f;
	for (; cin >> a >> b >> c >> d >> e >> f;) {
		//cin >> a >> b >> c >> d >> e >> f;
		//scanf_s("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f);

		if (a == 0) {
			swap(a, d);
			swap(b, e);
			swap(c, f);
		}
		b /= a;
		c /= a;
		a = 1;

		e -= b * d;
		f -= c * d;
		d = 0;

		f = f / e;
		e = 1;
		
		c -= f * b;
		b = 0;

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

int main() {
	q4();
	return 0;
}

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

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

int main(){
	double a,b,c,d,e,f,x,y;
	while(cin >> a >> b >> c >> d >> e >> f){
		if(!b){
			x=c/a;
			y=(f-d*x)/e;
		}else if(!e){
			x=f/d;
			x=(f-b*y)/a;
		}else if(!a){
			y=c/b;
			x=(f-e*y)/d;
		}
		else if(!d){
			y=f/e;
			x=(c-b*y)/a;
		}else{
			b/=a;c/=a;a/=a;
			e/=d;f/=d;d/=d;
			double high,low;
			high=1000.0;low=-1000.0;
			while(f+(b-e)*y!=c){
				y=(high+low)/2.0;
				if(f+(b-e)*y<c){
					if(b-e>=0)low = y;
					else high = y;
				}else if(f+(b-e)*y>c){
					if(b-e>=0)high = y;
					else low = y;
				}else{
					break;
				}
			}
			x = c-b*y;
		}
		printf("%.3lf %.3lf\n",x,y);
	}
}