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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (int) (1e9+7)
#define INF (int) 2e9

int main(){
    double a, b, c, d, e, f;
    while(cin >> a >> b >> c >> d >> e >> f){
        double delta = a*e-b*d;
        double x = round((e*c-b*f)/delta * 1000)/1000;
        double y = round((-d*c+a*f)/delta*1000)/1000;
        if(x==0) x = 0.000;
        if(y==0) y = 0.000;
        printf("%.3lf %.3lf\n", x, y);    
    }
    return 0;
}

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

#define     MAX_LENGTH     255
// #define     __DEBUGING__

using namespace std;

double num_abs_round(const double,const int);

int main(){
#ifdef __DEBUGING__
	double ip;
	int n;

	while(cin >> ip >> n){
		cout << num_abs_round(ip,n) << endl;
		printf("%.3f\n",num_abs_round(ip,n));
	}
#else
	double a,b,c,d,e,f;
	double det;
	double x,y;
	double X,Y;

	while (cin >> a >> b >> c >> d >> e >> f){
		// Det(係数行列) を計算
		det = (a * e) - (b * d);
		// Det(係数行列) ≠ 0 かどうかをチェック
		if(det == 0){
			cerr << "エラー：この連立方程式の解は存在しないか一意に定まらない" << endl;
			return -1;
		}

		// 解を求める
		x = ((e * c) - (b * f)) / det;
		y = ((a * f) - (d * c)) / det;

		// 整形
		X = num_abs_round(x,3) * ((x >= 0) ? 1 : (-1));
		Y = num_abs_round(y,3) * ((y >= 0) ? 1 : (-1));

		// 表示する
		printf("%.3f %.3f\n",X,Y);
	}
#endif

	return 0;
}

double num_abs_round(const double num,const int p){
	char num_str[MAX_LENGTH];
	char rtn_str[MAX_LENGTH];
	int i,j;
	bool flag = false;
	double rtn;

	// rtn_str の初期化
	for(i=0;i < ((int)(MAX_LENGTH));i++){
		rtn_str[i] = '\0';
	}

	// 数値を文字列に変換
	sprintf(num_str,"%f\0",num);

	// 符号の確認
	if(num_str[0] == '-'){
		j = 1;
		rtn_str[0] = '0';
	}else{
		j = 0;
	}

	// 小数点の検索 (num_str[j] に '.' が入っている)
	for(;num_str[j] != '.';j++){
		// 小数点がなければ num をそのまま返す
		if(num_str[j] == '\0'){
			return num;
		}
		// rtn_str に num_str をコピー
		rtn_str[j] = num_str[j];
	}

	// '.'をコピー
	rtn_str[j] = '.';

	// 小数点以下 (p + 1) 桁までをコピー
	for(i=1;i <= (p + 1);i++){
		// num が (p + 1) 桁未満だったら num をそのまま返す
		if(num_str[(j + i)] == '\0'){
			return num;
		}
		// rtn_str に num_str をコピー
		rtn_str[(j + i)] = num_str[(j + i)];
	}

	// 小数点以下 (p + 1) 桁を四捨五入
	if(((rtn_str[(j + p + 1)] - '0') >= 0) && ((rtn_str[(j + p + 1)] - '0') <= 4)){
		rtn_str[(j + p + 1)] = '\0';
	}else if((((int)(rtn_str[(j + p + 1)] - '0')) >= 5) && (((int)(rtn_str[(j + p + 1)] - '0')) <= 9)){
		flag = true;
		rtn_str[(j + p + 1)] = '\0';
	}else{
		return 0;
	}

	// rtn_str を数値に変換
	rtn = atof(rtn_str);

	// 五入の場合の処理
	if(flag == true){
		rtn += pow((double)10,(double)(p * (-1)));
	}

	return rtn;
}

C++: #include<iostream>
#include<iomanip>
#include<stdio.h>
#include<cmath>

using namespace std;

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

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

		double tempb = b;

		a*=e;b*=e;c*=e;
		d*=tempb;e*=tempb;f*=tempb;
		a-=d;b-=e;c-=f;

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

		if(x == -0)
			x = 0;
		if(y == -0)
			y = 0;
		x = floor((x+0.0005)*1000)/1000;
		y = floor((y+0.0005)*1000)/1000;
		printf("%0.3lf %0.3lf\n",x,y);
	}

	return 0;
}

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

int main(int argc, char *argv[]){
    double a,b,c,d,e,f;
	
	while(cin >> a>> b >> c>> d>> e >>f){
		double x,y;
		double b0,c0,e0,f0;

		b0=b*d; c0=c*d;
		e0=e*a; f0=f*a;
		
		y=(c0-f0)/(b0-e0);
		x=(c-b*y)/a;

		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
    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){
        x=(e*c-b*f)/(a*e-b*d);
        y=(-d*c+a*f)/(a*e-b*d);
        if(x==0)x=0;
        if(y==0)y=0;
        cout<<fixed<<setprecision(3)<<x<<" "<<fixed<<setprecision(3)<<y<<endl;
    }
    return 0;
}

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

}

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

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    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);
		y=(c*d-a*f)/(b*d-a*e);
		
		x*=1000;y*=1000;
		if(x<0){
			x-=0.5;
		}else{
			x+=0.5;
		}
		if(y<0){
			y-=0.5;
		}else{
			y+=0.5;
		}
		int xi = (int)x;
		int yi = (int)y;
		x = (double)xi;
		y = (double)yi;
		x/=1000;y/=1000;
		
		printf("%.3f %.3f\n", x, y);
	} 
	return 0;
}

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

using namespace std;

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

double round3(double dat){

	int fct;
	fct = (int)pow(10, 3);
	dat *= fct;
	dat = round(dat);
	dat /= fct;
	return dat;
}

int main()
{
	double x1, x2, y1, y2, a, b, c, d, e, f;

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

	x1 = x(a, b, c, d, e, f);
	y1 = y(a, b, c, d, e, f);

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

	x2 = x(a, b, c, d, e, f);
	y2 = y(a, b, c, d, e, f);




	cout << fixed << setprecision(3) << round3(x1) << " " << round3(y1) << endl;
	cout << fixed << setprecision(3) << round3(x2) << " " << round3(y2) << endl;

	return 0;
}

double x(double a, double b, double c, double d, double e, double f) {

	return (c*e - b*f) / (a*e - b*d);
}

double y(double a , double b, double c, double d, double e, double f) {

	return (a*f - c*d) / (a*e - b*d);
}

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

using namespace std;

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

  while(scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) {
    double x, y;
    double denom = a * e - b *d;
    double nomer_x = c*e - b*f;
    double nomer_y = -c*d + a*f;
    x = nomer_x / denom;
    y = nomer_y / denom;
    int f1 = 0, f2 = 0;
    if((int)x == 0) {
      printf("0.000 ");
      f1 = 1;
    }
    if(f1 == 0) {
      printf("%.3lf ", x);
    }
    if((int)y == 0) {
      printf("0.000\n");
      f2 = 1;
    }
    if(f2 == 0) {
      printf("%.3lf\n", y);
    }
  }

  return 0;
}

C++: #include<stdio.h>
void print_answer(int a,int b,int c,int d,int e,int f){
  double x,y;
  y=(c*d-f*a)/(b*d-e*a);
  x=(c-b*y)/a;
  printf("%5.3f ",x);
  printf("%5.3f\n",y);
}

int main(void){
  int n,a[2000],b[2000],c[2000],d[2000],e[2000],f[2000];
  int i=0,j;
  while(scanf("%d",&n)!=EOF){
      a[i]=n;
      scanf("%d",&n);
      b[i]=n;
      scanf("%d",&n);
      c[i]=n;
      scanf("%d",&n);
      d[i]=n;
      scanf("%d",&n);
      e[i]=n;
      scanf("%d",&n);
      f[i]=n;
      i++;
  }
  for(j=0;j<i;j++){
    print_answer(a[j],b[j],c[j],d[j],e[j],f[j]);
  }

  return(0);
}

C++: #include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	double a1, b1, c1, a2, b2, c2, A, B, C, X, Y;
	while (cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2) {
		A = a1, B = b1, C = c1;
		if (a1 != a2) {
			double tmp = a2 / a1;
			a1 *= tmp, b1 *= tmp, c1 *= tmp;
		}
		Y = (c2 - c1) / (b2 - b1);
		X = (C - B * Y) / A;
		printf("%.3f %.3f\n", X, Y);
	}
	return 0;
}