Go: package main

import (
	"fmt"
)

func main() {
	for {
		var a, b, c, d, e, f float64
		i, _ := fmt.Scan(&a, &b, &c, &d, &e, &f)
		if i == 0 {
			break
		}

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

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

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


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

        if (x == 0) {
            x = 0;
        }
        else if (y == 0) {
            y = 0;
        }
        
        printf("%.3f %.3f\n", x, y);
        
        
	}
    
    
	return 0;
}

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

int main(){
	double a, b, c, d, e, f, x, y;
	
	while(std::cin>>a>>b>>c>>d>>e>>f){
	
		y = (d*c-a*f) / (b*d-a*e); // 連立方程式のyの解
		x = (c-b*y) / a; // xの解
		
		std::cout << std::fixed << std::setprecision(3) << x << " " << y << "\n"; // 桁数の調整
	}
	return 0;
}

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

C++: #include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
        double a, b, c, d, e, f, g, h, i, j, k, l, m, n, x, y;

        while(scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF){
                g = a * d;      //公倍数
                j = b;
                k = c;
                l = a;
                b *= g / a;
                c *= g / a;
                e *= g / d;
                f *= g / d;
                a *= g / a;
                d *= g / d;

                h = b - e;
                i = c - f;

                y = i / h;
                x = k - y * j;
                x /= l;
                y *= 1000;
                y = floor(y + 0.5);
                y /= 1000;
                x *= 1000;
                x = floor(x + 0.5);
                x /= 1000;

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

        return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double a[60000000]={0};
	int i=0;
	while(cin>>a[i++]);
	int n=i-1;
	for(int j=0;j<n;j+=6){
		double k=a[j]/a[j+3],x=0,y=0;
		a[j+3]*=k,a[j+4]*=k,a[j+5]*=k;
		y=(a[j+2]-a[j+5])/(a[j+1]-a[j+4]);
		x=(a[j+2]-a[j+1]*y)/a[j];
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

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

int main(){
  while(cin){
    double A[2][3];
    for(int i=0;i<2;i++){
      for(int j=0;j<3;j++){
	cin>>A[i][j];
      }
    }
    for(int i=0;i<2;i++){
      for(int j=i+1;j<3;j++){
	A[i][j] /= A[i][i];
      }
      for(int k=0;k<2;k++){
	if(k!=i){
	  
	  for(int j=i+1;j<3;j++) A[k][j] -= A[k][i]*A[i][j];
	}
      }
    }
    cout<<fixed<<setprecision(3)<<A[0][2]<<" "<<A[1][2]<<endl;
  }
  return 0;
}

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

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

using namespace std;

typedef struct {
        double x1;
        double x2;
} answer;

answer solve_simultaneous_equations(double a, double b, double c, double d, double e, double f) {
        answer ans;
        ans.x1 = (c*e - b*f) / (a*e - b*d);
        ans.x2 = (c*d - a*f) / (b*d - a*e);
        return ans;
}

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

        while(cin >> a >> b >> c >> d >> e >> f) {
                answer ans;
                ans = solve_simultaneous_equations(a,b,c,d,e,f);
                cout << showpoint << fixed << setprecision(3) << ans.x1;
                cout << " ";
                cout << showpoint << fixed << setprecision(3) << ans.x2;
                cout << endl;
        }

        return 0;
}

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

int main(){
double a,b,j,d,e,f,a_,b_,c_,d_,e_,f_;
double x,y;
double in;
while (std::cin >>a>>b>>c>>d>>e>>f){
in_ = (a*e - b*d);
a_ = a/in;
b_ = -1*d/in;
d = -1*b/in;
e_ = e/in;
x = c * a_ + f*b_;
y = c*d_ + f*e_;
std::cout << std::setprecision(3) << x << ' ' << std::setprecision(3) << y << std::endl;
}
    return 0;
}

C++: #include <stdio.h>

double sishagonyu(double num)	{
	
	int num2;
	
	if (num == 0) return num;
	if (num > 0) { 
		num += 0.0005;
	} else {
		num -= 0.0005;
	}
	
	num *= 1000;
	num2 = (int)num;
	num = num2;
	num /= 1000;
	
	return num;
}

int main() {
	
	double a, b, c, d, e, f;	//scanf
	double x, y;							//ans
	
	double n = 0, m = 0, j = 0, h = 0, i = 0;						//temp
	
	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		
		//if (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) == EOF) break;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\n", a, b, c, d, e, f);	//input
		
		n = a / d;
		
		j = d * n;
		h = e * n;
		i = f * n;
		
		//printf("%lf %lf %lf\n%lf %lf %lf\t\t%lf\n", a, b, c, j, h, i, n);
		
		m = b - h;
		y = c - i;
		//printf("%lf %lf\n", m, y);
		
		if(y != 0) y /= m;
		//printf("%lf\n", y);
		
		i = c - (b * y);
		x = i / a;
		
		//printf("x = %lf, y = %lf\n", x, y);
		
		//x = sishagonyu(x);
		//y = sishagonyu(y);
		
		//printf("%lf %lf\n", x, y);
		printf("%.3lf %.3lf\n", x, y);
			}
	return 0;
}

C++: #include <iostream> //üoÍ
#include <vector>   //®Izñ
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
	double n;
	while(cin >> n){
		vector<double> vec;
		vec.push_back(n);
		for(int i=0;i<5;i++){
			cin >> n;
			vec.push_back(n);
		}
		double x = ((vec[2]*vec[4])-(vec[1]*vec[5]))/((vec[0]*vec[4])-(vec[1]*vec[3]));
		double y = (vec[2]-(vec[0]*x))/vec[1];

		x = floor((x*1000)+0.5)/1000;
		y = floor((y*1000)+0.5)/1000;
		printf("%.3f %.3f\n", x, y);
		
	}
	
		return 0;
}

C++: #include <cstdlib>
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;



int main()
{
double x1,x2,y1,c1,y2,c2,y,x;
while((scanf("%lf %lf %lf %lf %lf %lf",&x1,&x2,&y1,&y2,&c1,&c2))!=EOF)
{
x=((c1*y1-x2*c2)/(x1*c1-x2*y2));
y=((-(y2*y1)+x1*c2)/(x1*c1-x2*y2));
if(x==0)
{
x=0;
}
if(y==0)
{
y=0;
}
printf("%.3lf %.3lf\n",x,y);
}
return 0;
}

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

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

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

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

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

	return 0;
}

C++: #include <iostream>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;
#define F first
#define S second
const int INF=100000000;

int dp[50][3001];
const int mod=100000;

int main(){
	while(1){
		double n[6];
		double tmp[6];
		for(int i=0; i<6; ++i){
			cin >> n[i];
			tmp[i]=n[i];
		}

		double p=n[1]/n[4];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*p;
		double x=(tmp[2]-tmp[5])/(tmp[0]-tmp[3]);
		
		double q=n[0]/n[3];
		for(int i=3; i<6; ++i) tmp[i]=n[i]*q;
		double y=(tmp[2]-tmp[5])/(tmp[1]-tmp[4]);

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