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 <complex>
#include <cmath>
#define X real()
#define Y imag()
#define F first
#define S second
#define ML make_pair
#define EPS 1e-10
#define PI acos(-1)
using namespace std;
typedef long double  D;
typedef complex<double> P;
typedef complex<double> V;
typedef pair<P,P> L;


// 内積 (Inner Product) : a・b = |a||b|cosθ 1
D IP(V a, V b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}

// 外積 (Exterior Product) : |a×b| = |a||b|sinθ 2
D EP(V a, V b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

//交点判定
bool ISC(L l1,L l2){
	V v1,v2;
	v1=l1.S-l1.F;
	v2=l2.S-l2.F;
	if(abs(EP(v1,v2))<EPS)
		return false;
	else
		return true;
}

//　交点の座標
P IS(L l1,L l2){
	P p1,p2,p3,p4;
	p1=l1.F,p2=l1.S,p3=l2.F,p4=l2.S;
	D tmp=(EP(p4-p3,p3-p1)/EP(p4-p3,p2-p1));
	V v1=(tmp,tmp);
	return p1+(p2-p1)*v1;
}
int main(void){
	int n;
	cin >>n;
	for(int j=0;j<n;j++){
		P point[4],tmp1,tmp2;
		for(int i=0;i<3;i++)
			cin >> point[i].X >> point[i].Y;
		L l1,l2;
		tmp1=((point[0]+point[1])/P(2.0,0));
		D angle,r=1.0;
		angle=arg(point[1]-point[0]);
		angle+=PI/2.0;
		tmp2=polar(r,angle);
		l1=ML(tmp1,tmp1+tmp2);

		tmp1=(point[0]+point[2])/P(2.0,0);
		angle=arg(point[2]-point[0]);
		angle+=PI/2.0;
		tmp2=polar(r,angle);
		l2=ML(tmp1,tmp1+tmp2);

		point[3]=IS(l1,l2);
		cout.precision(3);
		cout << fixed << point[3].X << ' '<< point[3].Y << ' '<< abs(point[3]-point[0]) << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

double round_(double d){
	double ret = (int)(abs(d) * 1000 * 2 + 1) / 2 / 1000.0;
	ret *= d / abs(d);
	return ret;
}

int main()
{
    const double EPS = 1.0e-10;
    double a,b,c,d,e,f;
    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;
        a = x1 - x2;
        b = y1 - y2;
        c = (x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2) / 2;
        d = x1 - x3;
        e = y1 - y3;
        f = (x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3) / 2;
        x = (e * c - b * f) / (a * e - b * d);
        y = (a * f - d * c) / (a * e - b * d);
    	r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
    	x = round_(x);
    	y = round_(y);
    	r = round_(r);
//        if(-0.0005 < x && x < 0.0+EPS) x = 0.0;
//        if(-0.0005 < y && y < 0.0+EPS) y = 0.0;
 
        printf("%.3f %.3f %.3f\n",x,y,r);
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3,xp,yp,r;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		double a=x2-x1,b=y2-y1,c=x3-x1,d=y3-y1;
		if(a==0){
			xp = c/2+d/2/c-b*d/2/c;
			yp = b/2;
		}else if(b==0){
			xp = a/2;
			yp = -a*c/2/d+c*c/2/d+d/2;
		}else if(c==0){
			xp = a/2+b/2/a-d*b/2/a;
			yp = d/2;
		}else if(d==0){
			xp = c/2;
			yp = -a*c/2/b+a*a/2/b+b/2;
		}else{
			xp = (d*(a*a+b*b)-b*(c*c+d*d))/(a*d-b*c)/2;
			yp = -a*xp/b+a*a/2/b+b/2;
		}
		r = sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
		printf("%.3lf %.3lf %.3lf\n",xp,yp,r);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	int n;
	cin >> n;
	rep(i, n){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double vx21, vx31, vy21, vy31, tmp1, tmp2;
		vx21 = 2 * (x1 - x2);
		vx31 = 2 * (x1 - x3);
		vy21 = 2 * (y1 - y2);
		vy31 = 2 * (y1 - y3);
		tmp1 = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;
		tmp2 = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;
		
		double x, y, r;
		x = -(vy21 * tmp2 - vy31 * tmp1) / (vy31 * vx21 - vy21 * vx31);
		y = -(vx21 * tmp2 - vx31 * tmp1) / (vx31 * vy21 - vx21 * vy31);
		r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
		
		printf("%.3lf %.3lf %.3lf\n", x, y, r);
		
	}
 
	return 0;
}

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

//#include<iostream>
using namespace std;

int main(){
	int n;
	float x1, y1, x2, y2, x3, y3, xp,yp, xq, yq, s1, sr1, s2, sr2;
	float b1, b2, xc, yc, r;
	scanf("%d", &n);
	while(n--){
		scanf("%f%f%f%f%f%f",&x1, &y1, &x2, &y2, &x3, &y3);

		if(!(y2-y1)){ 
			r=x1; x1=x3; x3=r; r=y1; y1=y3; y3=r;
		}
		xp=(x2+x1)/2; yp=(y2+y1)/2;
		xq=(x3+x1)/2; yq=(y3+y1)/2;
		sr1=-(x2-x1)/(y2-y1); b1=yp-sr1*xp;
		sr2=-(x3-x1)/(y3-y1); b2=yq-sr2*xq;

		xc=-(b1-b2)/(sr1-sr2);
		yc=sr1*xc+b1;
		r=sqrt((xc-x1)*(xc-x1)+(yc-y1)*(yc-y1));
		printf("%.3f %.3f %.3f\n",xc, yc, r);
	}
	return 0;
}

C++: #include <cmath>
#include <cstdio>
using namespace std;
int main()
{
	int n;
	double x, y, x1, x2, x3, y1, y2, y3, a1, a2, b1, b2, c1, c2;
	scanf("%d", &n);
	for( ; n > 0; n--) {
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		a1=2*(x2-x1),b1=2*(y2-y1);
		c1=x1*x1-x2*x2+y1*y1-y2*y2;
		a2=2*(x3-x1),b2=2*(y3-y1);
		c2=x1*x1-x3*x3+y1*y1-y3*y3;
		x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
		y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
		printf("%.3lf %.3lf %.3lf\n", x, y, hypot(x - x1, y - y1));
	}

	return 0;
}