Go: package main

import (
	"fmt"
	"math"
)

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

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

func circleTriangle() {
	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 <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#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

const double EPS = 1e-9;

struct Point
{
	double x, y;

	Point() : x( 0 ), y( 0 ) {}
	Point( const double x, const double y ) : x( x ), y( y ) {}
	Point( const Point &a ) : x( a.x ), y( a.y ) {}
	
	const Point operator + ( const Point &a ) const
	{
		return Point( x + a.x, y + a.y );
	}

	Point& operator += ( const Point &a ) 
	{
		x += a.x;
		y += a.y;

		return *this;
	}

	const Point operator - ( const Point &a ) const
	{
		return Point( x + ( -a.x ), y + ( -a.y ) );
	}

	Point& operator -= ( const Point &a )
	{
		x -= a.x;
		y -= a.y;

		return *this;
	}

	const Point operator * ( const double a ) const
	{
		return Point( x * a, y * a );
	}

	Point& operator *= ( const double a )
	{
		x *= a;
		y *= a;

		return *this;
	}

	const Point operator / ( const double a ) const
	{
		return Point( x / a, y / a );
	}

	Point& operator /= ( const double a )
	{
		x /= a;
		y /= a;

		return *this;
	}

	bool operator < ( const Point &a ) const
	{
		return x == a.x ? y < a.y : x < a.x;
	}

	double abs() const
	{
		return sqrt( pow( x, 2. ) + pow( y, 2. ) );
	}

	const Point unitVector() const
	{
		return *this / abs();
	}

	const Point normalVector1() const
	{
		return Point( y, -x );
	}

	const Point normalVector2() const
	{
		return Point( -y, x );
	}
};

// 二点間の距離
double distance( const Point &a, const Point &b )
{
	return ( a - b ).abs();
}

// 外積（クロス積）
double cross( const Point &a, const Point &b )
{
	return a.x * b.y - a.y * b.x;
}


// 直線 ( p1, p2 ) と直線 ( q1, q2 ) の交点
Point lines_intersection( const Point &p1, const Point &p2, const Point &q1, const Point &q2 )
{
	return p1 + ( p2 - p1 ) * ( cross( q2 - q1, q1 - p1 ) / cross( q2 - q1, p2 - p1 ) );
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	cout << setprecision( 3 ) << fixed;

	int n;
	cin >> n;

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

		Point A( x1, y1 ), B( x2, y2 ), C( x3, y3 );
		double a = distance( B, C ), b = distance( C, A ), c = distance( A, B );

		Point midAB = ( A + B ) / 2;
		Point midAC = ( A + C ) / 2;
		
		Point p = lines_intersection( midAB, midAB + ( B - A ).normalVector1(), midAC, midAC + ( C - A ).normalVector1() );

		double cosA = ( pow( b, 2. ) + pow( c, 2. ) - pow( a, 2. ) ) / ( 2 * b * c );
		double sinA = sin( acos( cosA ) );
		double r = abs( a ) / abs( sinA ) / 2;

		cout << p.x << ' ' << p.y << ' ' << r << endl;
	}

	return 0;
}

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

int main() {
  int n;
  double a, b, c, d, e, f, px, py, r;
  cin >> n;
  while (cin >> a >> b >> c >> d >> e >> f) {
    double aa = a * a;
    double bb = b * b;
    double cc = c * c;
    double dd = d * d;
    double ee = e * e;
    double ff = f * f;
    py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee - ff)) /
         (2 * (e - a) * (b - d) - 2 * (c - a) * (b - f));
    if (c == a) {
      px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a));
    } else {
      px = (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a));
    }
    r = sqrt((px - a) * (px - a) + (py - b) * (py - b));
    cout << fixed << setprecision(3) << px << " " << py << " " << r << "\n";
  }
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


int main(){
	ios::sync_with_stdio(false);

	int n;
	vd x(3), y(3);
	double a1, a2, b1, b2, c1, c2;
	double px, py, r;

	scanf("%d", &n);

	for (; n > 0; n--){
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];

		a1 = 2 * (x[1] - x[0]);
		b1 = 2 * (y[1] - y[0]);
		c1 = x[0] * x[0] - x[1] * x[1] + y[0] * y[0] - y[1] * y[1];

		a2 = 2 * (x[2] - x[0]);
		b2 = 2 * (y[2] - y[0]);
		c2 = x[0] * x[0] - x[2] * x[2] + y[0] * y[0] - y[2] * y[2];

		px = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		py = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
		r = sqrt((px - x[0])*(px - x[0]) + (py - y[0])*(py - y[0]));

		printf("%.3lf %.3lf %.3lf\n", px, py, r);
	}

}

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

int main ()
{
    int num;
    double x1,y1,x2,y2,x3,y3;

    cin >> num;

    for( int i = 0; i < num; i++ )
    {
        double px = 0, py = 0, r = 0;
        double a, b, c, d, e, f, g;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

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

        cout << "a: " << a << " b: " << b << " c: " << c << " d: " << d << " e: " << e << " f: " << f << endl;
        g = (a*b-c*d) / (e-f);
        cout << "g: " << g << endl;
        */

        py = ((2*(x1-x2)*px+x2*x2-x1*x1+y2*y2-y1*y1)) / (2*(y2-y1));
        r = (px-x1)*(px-x1) + (py-y1)*(py-y1);

        cout << fixed;
        cout << setprecision(3) << px << " " << py << " " << sqrt(r) << endl;
    }

    return 0;
}