Go: package main

import "fmt"

func main() {

	for {
		var a, b, c, d, e, f float64
		var x, y float64
		i, _ := fmt.Scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f)
		if i != 6 {
			return
		}

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

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

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

using namespace std;

//?????¨?????\
double round_four(double value){
    //0??????
    if (value <= 0.00001 && value >= -0.00001){
        return 0;
    }
    //?????????
    value *= 1000;
    value += (value / fabs(value)) * 0.5;
    int nValue = static_cast<int>(value);
    value = static_cast<double>(nValue) / 1000;
    return value;
}

//????¬?????¨?????§£
array<double, 2> comp_linear_equation(int a, int b, int c, int d, int e, int f){
    array<double, 2> result;
    result[0] = static_cast<double>(e * c - (f * b));
    result[1] = static_cast<double>(-(d * c) + a * f);
    double num = 1.0 / ((a * e) - (b * d));
    result[0] *= num;
    result[1] *= num;
    result[0] = round_four(result[0]);
    result[1] = round_four(result[1]);
    return result;
}

//?????????
int main(){
    int a, b, c, d, e, f;
    vector<array<double, 2>> result;
    while (cin >> a >> b >> c >> d >> e >> f){
        result.push_back(comp_linear_equation(a, b, c, d, e, f));
    }
    for (const auto& element : result){
        for (auto num : element){
            cout << fixed << setprecision(3) << num << " ";
        }
        cout << endl;
    }
    return 0;
}

C++: #include<stdio.h>
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);
    }
}

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 main(){
	long double a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f){
		long double x,y;
		x=(c*e-b*f)/(e*a-b*d);
		y=(c*d-a*f)/(b*d-a*e);
		//if(x == -0) x=0;
		//if(y == -0) y=0;

		printf("%.3f %.3f\n",x,y);
		//cout << setprecision(3)  << x << " " << y << endl;
	}
	return 0;
}

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



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


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

		 y = (c*d - a*f) / (b*d - a*e);
		 x = (c - b*y) / a;
	
		 printf("%.3lf ", x);
		 printf("%.3lf\n", y);

	
	}


	
	
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#define EPS 1e-6

using namespace std;

double cross(double a, double b, double c, double d)
{
  return a * d - b * c;
}

int main()
{
  double a[3], b[3];
  while (scanf(" %lf %lf %lf %lf %lf %lf ", &a[0],&a[1],&a[2],&b[0],&b[1],&b[2]) == 6) {
    double x = cross(a[2], a[1], b[2], b[1]) / cross(a[0], a[1], b[0], b[1]),
      y = cross(a[0], a[2], b[0], b[2]) / cross(a[0], a[1], b[0], b[1]);
    if (fabs(x) < EPS) {x = fabs(x);}
    if (fabs(y) < EPS) {y = fabs(y);}
    printf("%.3lf %.3lf\n", x, y);
  }
  return 0;
}

C++: #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

string float_to_string(float f, int digits)
{
  if (f == 0) {
    f = 0;
  }
  ostringstream oss;
  oss << setprecision(digits) << setiosflags(ios::fixed) << f;
  return oss.str();
}

void calc_and_output(int *c)
{
  float x = (float)(c[1]*c[5]-c[2]*c[4])/(c[1]*c[3]-c[0]*c[4]);
  float y = (float)(c[0]*c[5]-c[2]*c[3])/(c[0]*c[4]-c[1]*c[3]);

  cout << float_to_string(x, 3) << " " << float_to_string(y, 3) << endl;
}

int main(int argc, char const* argv[])
{
  int c[6];

  string line;
  while (getline(cin, line)) {
    istringstream iss(line);
    int val;
    int c[6];
    for (int i = 0; i < 6; i++) {
      iss >> val;
      c[i] = val;
    };

    calc_and_output(c);
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void){
	while(scanf("")!=EOF){
		float equ[2][3];
		for(int i=0;i<2;i++)
			for(int j=0;j<3;j++)
				cin >> equ[i][j];
		float delta = -equ[0][0]*equ[1][1]+equ[0][1]

*equ[1][0];
		float y = (-equ[0][0]*equ[1][2]+equ[0][2]*equ

[1][0])/delta;
		float x = (equ[0][2]-equ[0][1]*y)/equ[0][0];
		printf("%.3f %.3f\n",x,y);
	}
}

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

int main(){
	float x, y;
	int a, b, c, d, e, f, xx, yy;
	string p, q;
	while (true){
		cin >> a >> b >> c >> d >> e >> f;
		if (cin.eof()){
			break;
		}
		if (a == 0){
			y = c / b;
			x = (f - e * y) / d;
		}
		else if (b == 0){
			x = c / a;
			y = (f - d * x) / e;
		}
		else if(d == 0){
			y = f / e;
			x = (c - b * y) / a;
		}
		else if(e==0){
			x = f / d;
			y = (c - a * x) / b;
		}
		else{
			x = (c*e - b*f) / (e*a - b*d);
			y = (c - a*x) / b;
		}
		xx = x / 1;
		yy = y / 1;
		p = to_string(xx);
		q = to_string(yy);
		p += ".";
		q += ".";
		b = x * 10;
		c = y * 10;
		for (int i = 1;i<4;i++){
			p += to_string((b*10) % 10);
			q += to_string((c*10) % 10);
			x = x * 10;
			y = y * 10;
			b = x;
			c = y;
		}
		cout << p << " " << q << endl;
	}
	return 0;
}

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

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

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

C++: #include <iostream>

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 = (c*d - a*f) / (b*d - a*e);

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

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

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