Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

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

using namespace std;

struct point{
	double x;
	double y;
};

struct linear{
	double a;
	double b;
	double c;
};

linear get_linear(point a, point b){
	linear l;

	if (a.x == b.x){
		l.a = 1;
		l.b = 0;
		l.c = a.x;
	}
	else if (a.y == b.y){
		l.a = 0;
		l.b = 1;
		l.c = a.y;
	}
	else{
		l.a = (b.x - a.x) / (b.y - a.y);
		l.b = -1;
		l.c = a.x * l.a - a.y;
	}
	return l;
}

linear get_linear_vertical(point p, linear l){
	linear lv;
	lv.a = (-1)*l.b;
	lv.b = l.a;
	lv.c = lv.a*p.x + lv.b*p.y;
	return lv;
}

point get_cross_point(linear l1, linear l2){
	point p;
	p.x = (l1.b*l2.c - l1.c*l2.b) / (l1.b*l2.a - l1.a*l2.b);
	p.y = (l1.c*l2.a - l1.a*l2.c) / (l1.b*l2.a - l1.a*l2.b);
	return p;
}

double point_distance(point s, point e){
	double d;
	d = (e.x - s.x)*(e.x - s.x) + (e.y - s.y)*(e.y - s.y);
	d = sqrt(d);
	return d;
}

int main()
{
	int n=1;
	double r;
	point p[3], mp, cp;
	linear l1, l2;

	cin >> n;
	for (int i = 0; i < n; ++i){
		cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y;

		l1 = get_linear(p[0], p[1]);
		mp.x = (p[1].x + p[0].x) / 2;
		mp.y = (p[1].y + p[0].y) / 2;
		l1 = get_linear_vertical(mp, l1);

		l2 = get_linear(p[0], p[2]);
		mp.x = (p[2].x + p[0].x) / 2;
		mp.y = (p[2].y + p[0].y) / 2;
		l2 = get_linear_vertical(mp, l2);

		cp = get_cross_point(l1, l2);
		r = point_distance(p[0], cp);

		cout << setprecision(3);
		cout << setiosflags(ios::fixed);
		cout << round(cp.x*1000.0)/1000.0 << ' '
			 << round(cp.y*1000.0)/1000.0 << ' '
			 << round(r*1000.0)/1000.0 << endl;
	}
	return 0;
}

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

using namespace std;

class Vector{
public:
	double x;
	double y;

	Vector(){}
	Vector( double dx, double dy ){
		x = dx;
		y = dy;
	}

	double operator*( const Vector& hoge ){
		return x * hoge.x + y * hoge.y;
	}

	Vector operator*( const double hoge )
	{
		return Vector( x * hoge, y * hoge );
	}

	Vector operator/( const double hoge )
	{
		return Vector( x / hoge, y / hoge );
	}

	Vector operator-( const Vector& hoge ){
		return Vector( x - hoge.x, y - hoge.y );
	}

	Vector operator-(){
		return Vector( -x, -y );
	}

	Vector operator+( const Vector& hoge ){
		return Vector( x + hoge.x, y + hoge.y );
	}
};

double change( double data )
{
	data *= 1000;
	data = int( data + .5 -( data < 0 ) );
	data /= 1000;
	return data;
}

int main(int argc, char const* argv[])
{
	Vector p1,p2,p3,circ;
	double r;
	int n;

	cin >> n;
	for( int i = 0;i < n;i++ ){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
		Vector e1,e2,e3;
		e1 = p3 - p2;
		e2 = p1 - p3;
		e3 = p2 - p1;

		double d1 = (-e2) * e3;
		double d2 = (-e3) * e1;
		double d3 = (-e1) * e2;
		double c1 = d2 * d3;
		double c2 = d3 * d1;
		double c3 = d1 * d2;
		double c = c1 + c2 + c3;

		circ = ( (p1 * (c2 + c3)) + (p2 * (c3 + c1)) + (p3 * (c1 + c2)) ) / (2 * c);
		r = sqrt( fabs((d1 + d2) * (d2 + d3) * (d3 + d1) / c) ) / 2;
		circ.x = change( circ.x );
		circ.y = change( circ.y );
		r = change( r );

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

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
#define int long long

signed main(){

        int n;
        scanf("%lld",&n);
        for(int i=0;i<n;i++){
                double x1,x2,x3,y1,y2,y3;
                scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
                double t1 = atan2(x2-x1,y2-y1);
                double t2 = atan2(x3-x1,y3-y1);
                double d = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
                double r = d/sin(abs(t1-t2))/2;
                double d2 = sqrt(r*r-d*d/4);
                double xc = (x3+x2)/2 - (y3-y2)/d*d2;
                double yc = (y3+y2)/2 - (x3-x2)/d*d2;
                printf("%.3f %.3f %.3f\n", xc,yc, r);

        }

        return 0;
}

C++: #include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main(void){
	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 a,b,c,d,e,f;
		a=-2*(x1-x2);
		b=-2*(y1-y2);
		c=x1*x1+y1*y1-x2*x2-y2*y2;
		d=-2*(x1-x3);
		e=-2*(y1-y3);
		f=x1*x1+y1*y1-x3*x3-y3*y3;
		double x,y,r;
		x=(b*f-c*e)/(a*e-b*d);
		y=(c*d-a*f)/(a*e-b*d);
		r=(x-x1)*(x-x1)+(y-y1)*(y-y1);
		r=sqrt(r);
		cout<<fixed<<setprecision(3)
			<<x<<" "<<y<<" "<<r<<endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef long long ll;
typedef unsigned long long ull;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( unsigned int i = (unsigned int)( m ); i < (unsigned int)( n ); i++ )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define RALL( c ) (c).rbegin(), (c).rend()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

double sqdist( double x1, double y1, double x2, double y2 )
{
	return pow( x1 - x2, 2 ) + pow( y1 - y2, 2 );
}

double dist( double x1, double y1, double x2, double y2 )
{
	return sqrt( sqdist( x1, y1, x2, y2 ) );
}

int main()
{
	int n;
	cin >> n;

	REP( dn, 0, n )
	{
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		double mx = ( x1 + x2 ) / 2, my = ( y1 + y2 ) / 2;
		double a = -( ( x2 - x1 ) / ( y2 - y1 ) );
		double th = atan( a );

		double low = -100.0, high = 100.0, mid = 0;

		REP( i, 0, 1000 )
		{
			mid = ( low + high ) / 2;
			double cx = mx + cos( th ) * mid, cy = my + sin( th ) * mid;

			double d1 = sqdist( x1, y1, cx, cy ), d2 = sqdist( cx, cy, x3, y3 );

			if ( d1 < d2 )
			{
				high = mid;
			}
			else if ( d2 < d1 )
			{
				low = mid;
			}
		}

		double rx = mx + cos( th ) * mid, ry = my + sin( th ) * mid;

		cout.precision( 4 );
		cout << setiosflags( ios::showpoint ) << rx << ' ' << ry << ' ' << dist( x1, y1, rx, ry ) << endl;
	}

	return 0;
}