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 <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <numeric>
#include <iomanip>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n;
double dx1, dx2, dx3, dy1, dy2, dy3;

int main(){
	cin >> n;
	REP(i, n){
		cin >> dx1 >> dy1 >> dx2 >> dy2 >> dx3 >> dy3;
		double a = 2 * (dx1 - dx2), b = 2 * (dy1 - dy2), c = (dx1*dx1 + dy1*dy1) - (dx2*dx2 + dy2*dy2);
		double d = 2 * (dx2 - dx3), e = 2 * (dy2 - dy3), f = (dx2*dx2 + dy2*dy2) - (dx3*dx3 + dy3*dy3);
		double x, y;
		//if (a < 0){
		//	a = -a;
		//	b = -b;
		//	c = -c;
		//}
		//if (d < 0){
		//	d = -d;
		//	e = -e;
		//	f = -f;
		//}
		//if (a == 0){
		//	y = c / b;
		//	x = (f - e*y) / d;
		//}
		//else if (b == 0){
		//	x = c / a;
		//	if (d == 0) y = f / e;
		//	else y = (f - e*x) / d;
		//}
		//else if (a != 0 && b != 0){
			x = (b*f - c*e) / (b*d - a*e);
			y = (c*d - a*f) / (b*d - a*e);
		//}
		cout << fixed << setprecision(3) << x << " " << y << " " << sqrt((dx1 - x)*(dx1 - x) + (dy1 - y)*(dy1 - y)) << endl;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <iomanip>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define SQ(i) ((i) * (i))
using namespace std;

int main(){
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2, x, y, a, b, c, cos_a, sin_a, r;
  int n;
  scanf("%d", &n);
  while(n--){
    scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
    a1 = 2 * (x2 - x1); a2 = 2 * (x3 - x1);
    b1 = 2 * (y2 - y1); b2 = 2 * (y3 - y1);
    c1 = SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2);
    c2 = SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3);
    x = (b1 * c1 - b2 * c1) / (a1 * b2 - a2 * b1);
    y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    r = SQ(x3-x) + SQ(y3 - y);
    r = sqrt(r);
    //    printf("%.3f %.3f %.3f\n",x, y, r);
    cout << fixed << setprecision(3) << x << " " << y << " " << r << endl;
  }
  return 0;
}

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

using namespace std;

bool get_snb( double , double , double , double , double& , double& );
double get_distance( double , double , double , double );

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

	double a[3] , b[3];

	double px, py;
	double r;

	int n;

	cin >> n;

	for( int k = 0 ; k < n ; k++ )
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		int i = 0;
		while(1)
		{
			if( get_snb( x1 , x2 , y1 , y2 , a[i] , b[i] ) == true ) i++;
			if( get_snb( x1 , x3 , y1 , y3 , a[i] , b[i] ) == true )
			{
				i++;
				if( i == 2 ) break;

			}
			if( get_snb( x2 , x3 , y2 , y3 , a[i] , b[i] ) == true )
			{
				i++;
				if( i == 2 ) break;
			}
		}

	
		px = -( b[0] - b[1] )/( a[0] - a[1] );
		py = a[0] * px + b[0];
	
		r = get_distance( x1 , px , y1 , py );

		cout.setf( ios::fixed , ios::floatfield );
		cout<< setprecision(3) << px << " " << py << " " << r << endl;
	}

	return 0;


}

bool get_snb( double x1 , double x2 , double y1 , double y2 , double& a , double& b )
{
	double cx, cy;
	a = -( x1 - x2 )/( y1 - y2 );

	if( y1 - y2 <= 0.0001 && y1 - y2 >= -0.0001 ) return false;
	if( x1 - x2 <= 0.0001 && x1 - x2 >= -0.0001 ) a = 0;
	
	cx = ( x1 + x2 ) / 2;
	cy = ( y1 + y2 ) / 2;

	b = cy - a * cx;

	return true;
}

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

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>


#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


int main()
{
	int n;
	cin >> n;
	REP(i, n){
		double x1, x2, x3, y1, y2, y3;
		cin >> x1>> y1 >> x2 >> y2 >> x3 >> y3;

		double x21 = x2 - x1;
		double x31 = x3 - x1;
		double y21 = y2 - y1;
		double y31 = y3 - y1;
		/*
		double xc = 1.0*((y31*(x21*x21 + y21*y21)) - (y21*(x31*x31 + y31*y31))) /
			(2 * (x21*y31 - y21*x31));

		double yc = 1.0*((x21*(x31*x31 + y31*y31)) - (x31*(x21*x21 + y21*y21))) /
			(2 * (x21*y31 - y21*x31));	
		*/

		double xc = ((y1 - y3)*(y1*y1 - y2*y2 + x1*x1 - x2*x2) - (y1 - y2)*(y1*y1 - y3*y3 + x1*x1 - x3*x3)) / (2 * (y1 - y3)*(x1 - x2) - 2 * (y1 - y2)*(x1 - x3));

		double yc = ((x1 - x3)*(x1 *x1 - x2 *x2 + y1 *y1 - y2 *y2) - (x1 - x2)*(x1*x1  - x3 *x3 + y1 *y1 - y3 *y3) ) / (2*(x1 - x3)*(y1 - y2) - 2*(x1 - x2)*(y1 - y3));

		double d = (xc - x1)*(xc - x1) + (yc - y1)*(yc - y1);
		d = sqrt(d);

		printf("%.3lf %.3lf %.3lf\n", xc, yc, d);
	}
	return 0;
}

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;
        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));
        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;
}