Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		cal()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func cal() {
	var x1, y1, x2, y2, x3, y3 float64
	fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)
	a := 2 * (x1 - x2)
	b := 2 * (y1 - y2)
	c := 2 * (x1 - x3)
	d := 2 * (y1 - y3)
	e := x1*x1 - x2*x2 + y1*y1 - y2*y2
	f := x1*x1 - x3*x3 + y1*y1 - y3*y3

	px := (d*e - b*f) / (a*d - b*c)
	py := (a*f - c*e) / (a*d - b*c)

	r := math.Sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py))
	fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
}

C++: #include <math.h>
#include <stdio.h>
 
int main()
{
    double x1,x2,x3,y1,y2,y3,r,xp,yp;
    int n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        xp=((y1-y2)*(x3*x3+y3*y3)+(y2-y3)*(x1*x1+y1*y1)+(y3-y1)*(x2*x2+y2*y2))/(2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)));
        yp=((x1-x2)*(x3*x3+y3*y3)+(x2-x3)*(x1*x1+y1*y1)+(x3-x1)*(x2*x2+y2*y2))/(2*(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2)));
        r=sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
        printf("%.3lf %.3lf %.3lf\n",xp,yp,r);
    }
    return 0;
}

C++:  /*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
 */

#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>

using namespace std;

 /*
http://zo3kirin3.net/?p=297
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q104383420
http://www.nn.iij4u.or.jp/~hsat/misc/math/centre/circumcentre.html
 */

int main() {
	int n; cin >> n;
	vector<double> x(3), y(3), x2(3), y2(3);		// x,yªÀWÌXgAx2,y2ªÀWÌñæÌXg
	
	for (int p=0; p<n; p++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
		for (int i=0; i<3; i++) {
			x2[i] = pow(x[i], 2);
			y2[i] = pow(y[i], 2);
		}
		
		// eÓÌ·³ðßéBO½ûÌèðp
		double a, b, c, a2, b2, c2;
		a2 = abs(pow(x[2]-x[1], 2) + pow(y[2]-y[1], 2));
        b2 = abs(pow(x[0]-x[2], 2) + pow(y[0]-y[2], 2));
        c2 = abs(pow(x[1]-x[0], 2) + pow(y[1]-y[0], 2));
		a = sqrt(a2); b = sqrt(b2); c = sqrt(c2);
		
		// ÊÏBwÌö®ðpB
		double s, S2;
		s = (a+b+c) / 2;
		S2 = s*(s-a)*(s-b)*(s-c);
		
		// OSðßéBö®ÍWeby[WðQÆ©xNgâÁÄÈ¢©çà¾Å«È¢c
		double px, py;
		px = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
        py = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
        
        // oÍB®`µÄoÍ·éB¼aÍ¼üÌûö®ÅB
        cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0])) << endl;
	}
	
	return 0;
}

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


int main(void){

  int n;
  cin >> n;
  while(n>0){
    
    for(int i = 0;i < n;i++){

      double x1,y1,x2,y2,x3,y3;
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

      double a = sqrt(pow(x2-x1,2) + pow(y2-y1,2));
      double b = sqrt(pow(x3-x2,2) + pow(y3-y2,2));
      double c = sqrt(pow(x3-x1,2) + pow(y3-y1,2));

      double r = a*b*c / sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));

      double A = pow(x2-x1,2) + pow(y2-y1,2);
      double B = pow(x3-x2,2) + pow(y3-y2,2);
      double C = pow(x3-x1,2) + pow(y3-y1,2);
      double s = (A*(B+C-A) + B*(C+A-B) + C*(A+B-C));


      double x = 2*A*(B+C-A) / s;
      double y = 2*B*(C+A-B) / s;
      if(x == 0){
        x = 0;
      }
      if(y == 0){
        y=0;
      }

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

    }
    n--;
  }




  return 0;
}

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

#define EPS 1e-9

double get_angle( double x1, double y1, double x2, double y2 )
{
	double angle;
	double m;
	if ( x1 == x2 ) angle = 90.0;
	else
	{
		m = ( y2 - y1 ) / ( x2 - x1 );
		angle = atan( m ) * 180.0 / M_PI;
	}
	return angle;
}

double get_radian( double x1, double y1, double x2, double y2 )
{
	if ( x1 == x2 ) return M_PI / 180.0;
	return atan( ( y2 - y1 ) / ( x2 - x1 ) );
}

double get_distance( double x1, double y1, double x2, double y2 )
{
	return sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) );
}

int main( void )
{
	int n; cin >> n;
	
	double x1, y1, x2, y2, x3, y3;
	for ( int i = 0; i < n; i++ )
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		double x12 = ( x1 + x2 ) / 2.0;
		double y12 = ( y1 + y2 ) / 2.0;
		double a12 = get_angle( x1, y1, x2, y2 ) - 90.0;
		double x13 = ( x1 + x3 ) / 2.0;
		double y13 = ( y1 + y3 ) / 2.0;
		double a13 = get_angle( x1, y1, x3, y3 ) - 90.0;

		double t12 = tan( a12 * M_PI / 180.0 );
		double t13 = tan( a13 * M_PI / 180.0 );
		double x, y;
		if ( fabs( a12 - 90.0 ) <= EPS || fabs( a12 + 90.0 ) <= EPS )
		{
			y = t13 * ( x12 - x13 ) + y13;
			x = x12;
		}
		else if ( fabs( a13 - 90.0 ) <= EPS || fabs( a13 + 90.0 ) <= EPS )
		{
			y = t12 * ( x13 - x12 ) + y12;
			x = x13;
		}
		else
		{
			x = ( t12 * x12 - t13 * x13 + y13 - y12 ) / ( t12 - t13 );
			y = t12 * ( x - x12 ) + y12;
		}
		double r = get_distance( x1, y1, x, y );

		/*
		cout << "=== test ==============" << endl;
		cout << "a12 = " << a12 << endl;
		cout << "t12 = " << t12 << endl;
		cout << "x12 = " << x12 << endl;
		cout << "y12 = " << y12 << endl;
		cout << endl;
		cout << "a13 = " << a13 << endl;
		cout << "t13 = " << t13 << endl;
		cout << "x13 = " << x13 << endl;
		cout << "y13 = " << y13 << endl;
		cout << "=======================" << endl;
		*/

		cout.setf( ios::fixed );
		cout.precision( 3 );
		cout << x << " " << y << " " << r << endl;
	}

	return 0;
}

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


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

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

using namespace std;

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double veku1[3], veku2[3];
		veku1[0] = x2-x1;
		veku1[1] = y2-y1;
		veku2[0] = x3-x1;
		veku2[1] = y3-y1;
		veku1[2] = veku1[0]*veku1[0]+veku1[1]*veku1[1];
		veku2[2] = veku2[0]*veku2[0]+veku2[1]*veku2[1];
		double naiseki = veku1[0]*veku2[0]+veku1[1]*veku2[1];
		double p, q;
		q = (veku1[2]*veku2[2]-naiseki*veku1[2])/(2.0*(veku1[2]*veku2[2]-naiseki*naiseki));
		p = (veku1[2]*veku2[2]-naiseki*veku2[2])/(2.0*(veku1[2]*veku2[2]-naiseki*naiseki));
		double k[2];
		k[0] = x1+p*veku1[0]+q*veku2[0];
		k[1] = y1+p*veku1[1]+q*veku2[1];
		double pp = sqrt((k[0]-x1)*(k[0]-x1)+(k[1]-y1)*(k[1]-y1));
		k[0] *= 1000.0;
		if (k[0]-(int)k[0] >= 0.5) {
			k[0] += 1.0;
		}
		k[0] /= 1000.0;
		k[1] *= 1000.0;
		if (k[1]-(int)k[1] >= 0.5) {
			k[1] += 1.0;
		}
		k[1] /= 1000.0;
		pp *= 1000.0;
		if (pp-(int)pp >= 0.5) {
			pp += 1.0;
		}
		pp /= 1000.0;
		printf("%.3f %.3f %.3f\n", k[0], k[1], pp);
	}
	return 0;
}