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

void gradcut(double *a,double *b,double x1,double y1,double x2,double y2);
double fixzero(double z){
    if (z==-0) return 0;
    else return z;
}
int main() {
    double x[3],y[3],a[2],b[2],rx,ry,r;
    int n;
    std::cin >> n;
    for(int j=0;j<n;j++){
        int am=0,add=1;;
        for(int i=0;i<3;i++) std::cin >> x[i] >> y[i];
        for(int i=0;i<3;i++){
            if(i==2) add=-2;
            if(x[i]!=x[i+add]&&y[i]!=y[i+add]){
                gradcut(&a[am],&b[am],x[i],x[i+add],y[i],y[i+add]);
                am++;
                if(am>2) break;
            }else if(x[i]==x[i+add]){
                a[am]=0;
                b[am]=(y[i]+y[i+add])/2;
                am++;
                if(am>2) break;
            }
        }


        rx = (b[1]-b[0])/(a[0]-a[1]);
        ry = a[0]*rx+b[0];
        r=sqrt((x[0]-rx)*(x[0]-rx)+(y[0]-ry)*(y[0]-ry));
        printf("%.3f %.3f %.3f\n",fixzero(rx),fixzero(ry),fixzero(r));
    }
    return 0;
}

void gradcut(double *a,double *b,double x1,double x2,double y1,double y2){
    *a=-(x2-x1)/(y2-y1);
    *b=(y1+y2)/2-(*a)*(x1+x2)/2;
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
struct {double x, y;} p[3];
using namespace std;
int main()
{
	int t, i, j;
	double r, a, b, c, d, e, f, l, m, n;
	cin >> t;
	for (i = 0; i < t; i++)
	{
		for (j = 0; j < 3; j++)
			cin >> p[j].x >> p[j].y;
		a = p[0].x-p[1].x;
		b = p[0].y-p[1].y;
		c = -(p[0].x*p[0].x)-(p[0].y*p[0].y)+(p[1].x*p[1].x)+(p[1].y*p[1].y);
		d = p[1].x-p[2].x;
		e = p[1].y-p[2].y;
		f = -(p[1].x*p[1].x)-(p[1].y*p[1].y)+(p[2].x*p[2].x)+(p[2].y*p[2].y);
		m = (c*d-a*f)/(b*d-a*e);
		l = (c*e-b*f)/(e*a-b*d);
		n = -((p[0].x*p[0].x)+(p[0].y*p[0].y)+p[0].x*l+p[0].y*m);
		cout << setprecision(3) << setiosflags(ios::fixed);
		cout << -l/2 << " " << -m/2 << " " << sqrt(l*l+m*m-4*n)/2 << endl;
	}
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;
 
double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;
 
    ret = cross(p1,p2)/2.0;
     
    return abs(ret);
}
 
int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
         
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        printf("%.3lf %.3lf %.3lf\n",X,Y,R);
 
    }
    return 0;
}

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

inline double square(double x){return x*x;}
inline double Roundoff(double x){
	if( x<0 ){
		x*=-1;
		x=(x-(x-int(x*1000)/1000))+(((x*1000)-int(x*1000))*10)>=4?0.001:0;
		x*=-1;
	}else{
		x=(x-(x-int(x*1000)/1000))+(((x*1000)-int(x*1000))*10)>=4?0.001:0;
	}
	return x;
}

void SolveSimultEq(double &x,double &y,double a,double b,double c,double d,double e,double f);
int main(){
	int datanum;
	double *x1,*y1,*x2,*y2,*x3,*y3;
	cin>>datanum;
	x1=new double[datanum];
	y1=new double[datanum];
	x2=new double[datanum];
	y2=new double[datanum];
	x3=new double[datanum];
	y3=new double[datanum];
	
	for( int i=0;i<datanum;i++ ){
		cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]>>x3[i]>>y3[i];
	}
	for( int i=0;i<datanum;i++ ){
		double px,py,r;
		
		SolveSimultEq(px,py,2*(x1[i]-x2[i]),2*(y1[i]-y2[i]),square(x1[i])-square(x2[i])+square(y1[i])-square(y2[i]),
  			  	    2*(x2[i]-x3[i]),2*(y2[i]-y3[i]),square(x2[i])-square(x3[i])+square(y2[i])-square(y3[i]));
		r=squaret(square(x1[i]-px)+square(y1[i]-py));
		cout<<fixed<<setprecision(3)<<px<<" "<<setprecision(3)<<py<<" "<<setprecision(3)<<r<<endl;

	}

	delete x1;
	delete y1;
	delete x2;
	delete y2;
	delete x3;
	delete y3;
	return 0;
}

void SolveSimultEq(double &x,double &y,double a,double b,double c,double d,double e,double f){
	double delta=a*e-b*d;
	
	x=(c*e-b*f)/delta;
	y=(a*f-c*d)/delta;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
typedef vector <double> vd;
typedef vector <　vd　> vvd;

vvd inverse(vvd &x){
	vvd tmp(2, vd(2));
	if (x.size()!=2) return tmp;
	double a, b, c, d, e;
	a = x[0][0];
	b = x[0][1];
    c = x[1][0];
	d = x[1][1];
    e = 1.0 / (a*d-b*c);
	tmp[0][0] = d * e;
	tmp[0][1] = -b * e;
	tmp[1][0] = -c * e;
	tmp[1][1] = a * e;
	return tmp;
}

vvd Mmult(vvd &A, vvd &B){
    int n1=A.size();
    int n2=A[0].size();
	int n3=B[0].size();
	vvd C(n1, vd(n3));
	for (int i=0; i<n1; i++)
		for (int j=0; j<n3; j++)
			C[i][j] = 0;

    for (int i=0; i<n1; i++)
		for (int j=0; j<n2; j++)
			for (int k=0; k<n3; k++)
				C[i][k] += A[i][j] * B[j][k];
    return C;
}

int main(void){
    int n;
	double x1, y1, x2, y2, x3, y3, dx1, dy1, dx2, dy2;
	vvd A(2, vd(2)), B(2, vd(1));
	cin>>n;
	for (int i=1; i<n+1; i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		dx1 = x2 - x1;
		dy1 = y2 - y1;
		dx2 = x3 - x1;
		dy2 = y3 - y1;
		A[0][0] = -dx1;
		A[0][1] = dy1;
		A[1][0] = -dx2;
		A[1][1] = dy2;
		B[0][0] = -dx1*(x1+x2)/2 + dy1*(y1+y2)/2;
		B[1][0] = -dx2*(x1+x3)/2 + dy2*(y1+y3)/2;
		B = Mmult(inverse(A), B);

		double r = pow(pow(B[0][0]-x1,2)+pow(B[1][0]-y1,2), 0.5);
	    cout<<fixed<<setprecision(3);
		cout<<B[0][0]<<" "<<B[1][0]<<" "<<r<<endl;
	}
    return 0;
}

C++: // 0010
#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;
}