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 <stdio.h>

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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-6

int main(){
	int a,b,c,d,e,f;
	while(~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)){
		int p = c*e - b*f;
		int q = a*e - b*d;
		double x,y;
		
		//printf("p:%d  , q:%d\n",p,q);
		if( q!=0 ){
			x = (double)abs(p) / (double)abs(q);
			if( p<0&&q>0 || p>0&&q<0 ) x *= -1;
		}else{
			puts("???");
		}
		if( e!=0 ){
			y = (double)( f - d*x ) / (double)e + EPS;
		}else{
			puts("???????");
		}
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

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

C++: #include <stdio.h>
#include<string>
#include<string.h>
#include <math.h>
#include<iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
using namespace  std;


/*
//my header
#include "define.h"
#include "geometry.h"*/

#define MyAbs(a) ((a)>0?(a):-(a))
#define MyEqualDoule(a,b) (MyAbs(a-b)<1e-6)

void init()
{
#ifdef _WIN32
	freopen("1.txt", "r", stdin);
#endif
}

void func();

int main()
{
	init();
	func();

	return 0;
}


void func()
{
	double a,b,c,d,e,f, x, y;
	while(~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f))
	{
		if(MyEqualDoule(a*e-b*d,0))
			x = 0;
		else
			x = (c*e-f*b)/(a*e - b*d);

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

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/

#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

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

	while (cin >> a >> b >> p >> c >> d >> q)
	{
		x = (p*d - b*q) / (a*d - b*c);
		y = (a*q - p*c) / (a*d - b*c);
		
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
	return 0;
}

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

int main(){
  int i;
  float x[6];

  while(cin >> x[0]){
    for(i=1; i<6; i++){
      cin >> x[i];
    }

    //normalize
    x[1]/=x[0]; x[2]/=x[1]; x[0]=1;

    //subtraction
    x[4]-=x[3]*x[1]; x[5]-=x[3]*x[2]; x[3]=0;

    //normalize
    x[5]/=x[4]; x[4]=1;

    //subtraction
    x[2]-=x[1]*x[5]; x[1]=0;

    printf("%f %f\n", x[2], x[5]);
  }

  return 0;
}

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

using namespace std;

int main(){
	cout << setprecision(3) << setiosflags(ios::fixed);
	double x[2];
	double y[2];
	for(int h = 0; h < 2; ++h){
		double a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		x[h] = (c*e-f*b)/(a*e-d*b);
		y[h] = (c*d-f*a)/(b*d-a*e);
	
		}
	
	cout << x[0] << " " << y[0] << '\n';
	cout << x[1] << " " << y[1] << '\n';
	return 0;
}

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

int main()
{
	int a,b,c,d,e,f;
	double x,y;
	while(cin>>a>>b>>c>>d>>e>>f)
	{
               
               if (a*e == b*d)
               {
                   cout<<'No Answer'<<endl; 
                   continue;
               }
		x= (c*e-b*f)/(a*e-b*d);
		y= (c*d-a*f)/(b*d-a*e);


               if(x == -0.0){ x = 0.0;}
               if(y == -0.0){ y = 0.0; }
	       
               cout<<setprecision(3)<<fixed;
	       cout<<x<<" "<<y<<endl;
	}
	return 0;
}

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

int main(){
  double a,b,c,d,e,f;
  while(cin >> a >> b >> c >> d >> e >> f){
    double x = (e*c - b*f)/(e*a - b*d) + 1e-10;
    double y = (d*c - a*f)/(d*b - a*e) + 1e-10;
    cout << fixed << setprecision(3) << x << " " << y << endl;
  }
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<string>
#include<cctype>
#include<vector>
#include<queue>
#include<map>
using namespace std;

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

	while (cin >> a >> b >> c >> d >> e >> f) {
		//a*d-b*c=0:?§£??????
		G = 1 / (a*e - b*d);
		x = G*(e*c + (-b)*f);
		y = G*((-d)*c + a*f);
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}

	return 0;
}

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

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

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

#include <iostream>
#include <vector>
#include <algorithm>

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

  while( std::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 = (double)(long)(x*1000);
    y = (double)(long)(y*1000);

    x /= 1000;
    y /= 1000;    

    printf("%.03lf %.03lf\n", x, y); 
  }

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

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

using namespace std;

double A[2][2];
double B[2];
double Ainv[2][2];

int main()
{
	while(scanf("%lf %lf %lf %lf %lf %lf", &A[0][0], &A[0][1], &B[0],
				&A[1][0], &A[1][1], &B[1]) != EOF)
	{
		double det = A[0][0] * A[1][1] - A[1][0] * A[0][1];
		if(det == 0.0)
		{
			cout << "this equation has no answer." << endl;
			return -1;
		}

		Ainv[0][0] = A[1][1] / det;
		Ainv[0][1] = -A[0][1] / det;
		Ainv[1][0] = -A[1][0] / det;
		Ainv[1][1] = A[0][0] / det;
		
		double ans_x = Ainv[0][0] * B[0] + Ainv[0][1] * B[1];
		double ans_y = Ainv[1][0] * B[0] + Ainv[1][1] * B[1];

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