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 <cmath>
#include <algorithm>

using namespace std;

int main()
{
	double A1, B1, C1, A2, B2, C2;
	double X1, X2, X3, Y1, Y2, Y3;
	double X, Y, R;

	int n;
	cin>>n;

	for(int i = 0; i < n; i++){
		cin>>X1>>Y1>>X2>>Y2>>X3>>Y3;

		A1=2*(X2-X1);
		B1=2*(Y2-Y1);
		C1=pow(X1,2)-pow(X2,2)+pow(Y1,2)-pow(Y2,2);
		A2=2*(X3-X1);
		B2=2*(Y3-Y1);
		C2=pow(X1,2)-pow(X3,2)+pow(Y1,2)-pow(Y3,2);

		X = (B1*C2-B2*C1)/(A1*B2-A2*B1);
		Y = (C1*A2-C2*A1)/(A1*B2-A2*B1);

		R = sqrt(pow(max(X,X1)-min(X,X1),2)+pow(max(Y,Y1)-min(Y,Y1),2));

		if(X >= 0) X = ((double)((int)(X*1000+0.5)))/1000;
		else X = ((double)((int)(X*1000-0.5)))/1000;
		if(Y >= 0) Y = ((double)((int)(Y*1000+0.5)))/1000;
		else Y = ((double)((int)(Y*1000-0.5)))/1000;
		if(R >= 0) R = ((double)((int)(R*1000+0.5)))/1000;
		else R = ((double)((int)(R*1000-0.5)))/1000;

		printf("%.3f %.3f %.3f",X, Y, R);
	}
}

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

int main(){

	int n;
	double x1, y1, x2, y2, x3, y3;
	double la, lb, lc;
	double a, b, c;
	
	double r;
	double px, py;

	cin >> n;

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

		//lc = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
		la = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
		//lb = (x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1);

		a = fabs((atan2( y2 - y1, x2 - x1 ) - atan2( y3 - y1, x3 - x1 )));
		b = fabs((atan2( y1 - y2, x1 - x2 ) - atan2( y3 - y2, x3 - x2 )));
		c = fabs((atan2( y1 - y3, x1 - x3 ) - atan2( y2 - y3, x2 - x3 )));

		r = sqrt(la) / (sin(a)*2);
		px = ( sin(2*a) * x1 + sin(2*b) * x2 + sin(2*c) * x3 ) / (sin(2*a)+sin(2*b)+sin(2*c));
		py = ( sin(2*a) * y1 + sin(2*b) * y2 + sin(2*c) * y3 ) / (sin(2*a)+sin(2*b)+sin(2*c));

		r = floor(r*10000+0.5)/10000;
		px = floor(px*10000+0.5)/10000;
		py = floor(py*10000+0.5)/10000;

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

	}
	return 0;
}