Go: package main

import "fmt"

func main() {
	var Xs, Ys []float32
	Xs = make([]float32, 0)
	Ys = make([]float32, 0)
	var cnt int
	for {
		var a, b, c, d, e, f, x, y float32
		fmt.Scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)
		if a == 0 {
			break
		}
		y = (((a * f) - (d * c)) / ((a * e) - (b * d)))
		x = ((c - (b * y)) / a)
		Xs = append(Xs, x)
		Ys = append(Ys, y)
		cnt++
	}
	for i := 0; i < cnt; i++ {
		fmt.Printf("%.3f %.3f\n", Xs[i], Ys[i])
	}
}

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

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

C++: #include<iostream>
#include<iomanip>
#include<cmath>
double r(double x,int n){
  for(int i=0;i<n;i++) x *= 10;
  x = floor(x+0.5);
  for(int i=0;i<n;i++) x /= 10;
  return x;
}
using namespace std;
int main(){
  double a,b,c,d,e,f,x,y,hy,dk;
  int n;
  while(cin>>a>>b>>c>>d>>e>>f){
    a *= d;
    b *= d;
    c *= d;//方程式にd倍
    dk = d;
    d *= (a/dk);
    e *= (a/dk);
    f *= (a/dk);//方程式にa倍
    y = (c-f)/(b-e);
    a /= d;
    b /= d;
    c /= d;//元の方程式
    hy = y * b;
    x = (c-hy)/a;
    cout << fixed << setprecision(3) << r(x,3) << ' ' << r(y,4) << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

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

using namespace std;

int main(void){
    
    int i,j=0,k = 0,l=0,m = 0,n= 0;
    double a,b,c,d,e,f;
    double x1[1000],x2[1000];
    
    while(
            cin >> a >> b >> c >> d >> e >> f)
    {
        double gyouretusiki = (a*e - d*b);
    
        x1 [n]= (c/a) - (b/gyouretusiki)*(f -((d*c)/a));
    
        x2[n] = ((a) /(gyouretusiki))*(f-((d*c)/a));
        
    
        REP(i,5)
        {
            x1[n] =x1[n]*10;
            x2[n] = x2[n]*10;
        }
            x1[n] += 0.5;
            x2[n] += 0.5;
            x1[n] = (int)x1[n];
            x2[n] = (int)x2[n];
        REP(i,5)
        {
            x1[n] =x1[n]/10;
            x2[n] = x2[n]/10;
        }
        n++;
    }
    REP(i,n)
    printf("%.3f %.3f\n",x1[n],x2[n]);
    return 0;
            
                  
                  
    
}

C++: #include<iostream>
#include<iomanip>
int main()
{
	double result[2000][2];
	int num;
	for(int i = 0;; i++)
	{
		double a, b, c, d, e, f;
		std::cin >> a >> b >> c >> d >> e >> f;
		if(std::cin.eof())
		{
			num = i;
			break;
		}
		result[i][0] = (b * f - c * e) / (b * d - a * e);
		result[i][1] = (c * d - a * f) / (b * d - a * e);
		for(int j = 0; j < 2; j++)
		{
			if(result[i][j] == -0)
			{
				result[i][j] = 0;
			}
		}
	}
	std::cout << std::fixed << std::setprecision(3);
	for(int i = 0; i < num; i++)
	{
		std::cout << result[i][0] << ' ' << result[i][1] << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
 
using namespace std;
 
int main()
{
  int a,b,c,d,e,f;
  double A[2][2];
  double B[2];
  double inv_A[2][2];
  while(~scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)){
    int det = a*e-b*d;
    A[0][0]=a; A[0][1] = b;
    A[1][0]=d; A[1][1] = e;
    B[0] = c;
    B[1] = f; 
 
    inv_A[0][0]=A[1][1]; inv_A[0][1]=-A[0][1];
    inv_A[1][0]=-A[1][0]; inv_A[1][1]=A[0][0];
 
    double res[2];
    res[0]=0;
    res[1]=0;
 
 
    for(int j=0;j<2;j++){
      for(int k=0;k<2;k++){
	res[j]+=1.0/(double)det *inv_A[j][k]*B[k];
      }
    }
 
    printf("%.3f %.3f\n",res[0],res[1]);
  }
}

C++: #include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	double x[50];
	double y[50];
	double a, b, c, d, e, f;
	int i = 0;
	do
	{
		cin >> a >> b >> c >> d >> e >> f;
		double sum_d = (a*e - b * d);
		y[i] = (a*f - c * d) / sum_d;
		x[i] = (c * e - b * f) / sum_d;
		++i;
	} while (cin.get() != EOF);
	--i;
	for (int j = 0; j <= i; ++j)
	{
		if ((x[j] - 0) < 0.0001 && (x[j] - 0) > -0.0001)
		{
			x[j] = 0;
		}
		else if ((y[j] - 0) < 0.0001&& (y[j] - 0) > -0.0001)
		{
			y[j] = 0;
		}
		cout << fixed << setprecision(3) << x[j] << " " << y[j]<<endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.se2", "r", stdin);
	string str = "";

	while (getline (cin, str )){
		// ax + by = c
		// dx + ey = f
		double a, b, c, d, e, f;
		stringstream ss(str);
		ss >> a >> b >> c >> d >> e >> f;
		// [ a b ][x] = [c]
		// [ d e ][y]   [f]
		// [x] = [e -b][c]
		// [y]   [-d a][f]/D
		double D = a*e - b*d;
		double y = (a*f - d*c)/D;
		double x = (c - b*y)/a;

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

	} // end for

	return 0;
}

C++: #include<stdio.h>

int a ;
int b ;
int c ;
int d ;
int e ;
int f ;
double x ;
double y ;

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

C++: #include<iostream>
#include<stdio.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 = (double)((e*c-b*f) / (a*e-b*d));
  y = (double)((-(d*c)+a*f) / (a*e-b*d));
  if(x == 0){x = 0;}
  if(y == 0){y = 0;}
  printf("%.3f %.3f\n",x,y);
 }
}

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

int main() {

  int a,b,c,d,e,f;

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

    double x = 1.00;
    if ( ( c*e - f*b ) * ( a*e - d*b ) != 0 ) {
      x = x * ( c*e - f*b ) / ( a*e - d*b );
    }else {
      x = 0.00;
    }
    double y = 1.00;
    if ( ( c*d - f*a ) * ( b*d - e*a ) != 0 ) {
      y = y * ( c*d - f*a ) / ( b*d - e*a );
    }else {
      y = 0.00;
    }

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

  }

  return 0;

}

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

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

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

C++: #include <stdio.h>
#include <stdlib.h>
#include <math.h>

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

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

int main() {
	double a, b, c, d, e, f, x, y;
	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()) {
		x = (c - f*b / e) / (a - d*b / e);
		y = (c - a*x) / b;
	             printf("%.3lf %.3lf\n",x,y);	}
}

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

int main(){
	double  a, b, c, d, e, f, num[6];
	while(cin >> a >> b >> c >> d >> e >> f){
		num[0] = a;
		num[1] = b;
		num[2] = c;
		num[3] = d;
		num[4] = e;
		num[5] = f;
		b *= d;
		c *= d;
		e *= a;
		f *= a;
		b -= e;
		c -= f;
		c /= b;
		num[0] *= num[4];
		num[2] *= num[4];
		num[3] *= num[1];
		num[5] *= num[1];
		num[0] -= num[3];
		num[2] -= num[5];
		num[2] /= num[0];
		if(num[2] == -0)
			num[2] = 0;
		if(c == -0)
			c = 0;
		cout << fixed << setprecision(3) << num[2] << ' ' << c << endl;
	}
    return 0;
}