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

using namespace std;
double min(double x0, double x1, double x2){ return min(min(x0, x1), x2); }
double max(double x0, double x1, double x2){ return max(max(x0, x1), x2); }
double d(double x, double y, double p, double q){ return sqrt((p-x)*(p-x)+(q-y)*(q-y)); }
double diff(double x0, double x1, double x2){ return max(x0,x1,x2)-min(x0,x1,x2); }
int main(){
	int n;
	cin >> n;
	double x[3], y[3];
	for(int j=0; j<n; j++){
	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
	double ax,ay, r;
	double p, q;
	ax = (max(x[0],x[1],x[2]) + min(x[0],x[1],x[2]))/2;
	ay = (max(y[0],x[1],x[2]) + min(x[0],x[1],x[2]))/2;
	p = (max(x[0],x[1],x[2]) - min(x[0],x[1],x[2]))/4;
	q = (max(y[0],x[1],x[2]) - min(x[0],x[1],x[2]))/4;

	for(int i=0; i<10; i++){
		p = (max(x[0],x[1],x[2]) - min(x[0],x[1],x[2]))/4;
		q = (max(y[0],x[1],x[2]) - min(x[0],x[1],x[2]))/4;
		while(1){
		if(diff(d(x[0],y[0],ax+p,ay),d(x[1],y[1],ax+p,ay),d(x[2],y[2],ax+p,ay)) == diff(d(x[0],y[0],ax-p,ay),d(x[1],y[1],ax-p,ay),d(x[2],y[2],ax-p,ay))){
		}
		else if(diff(d(x[0],y[0],ax+p,ay),d(x[1],y[1],ax+p,ay),d(x[2],y[2],ax+p,ay)) > diff(d(x[0],y[0],ax-p,ay),d(x[1],y[1],ax-p,ay),d(x[2],y[2],ax-p,ay))){
			ax -= p;
		}
		else if(diff(d(x[0],y[0],ax+p,ay),d(x[1],y[1],ax+p,ay),d(x[2],y[2],ax+p,ay)) < diff(d(x[0],y[0],ax-p,ay),d(x[1],y[1],ax-p,ay),d(x[2],y[2],ax-p,ay)) ){
			ax += p;
		}
		if(p<0.0001) break;

		p /= 2;
		}

		while(1){
		if(diff(d(x[0],y[0],ax,ay+q),d(x[1],y[1],ax,ay+q),d(x[2],y[2],ax,ay+q)) == diff(d(x[0],y[0],ax,ay-q),d(x[1],y[1],ax,ay-q),d(x[2],y[2],ax,ay-q))){
		}
		if(diff(d(x[0],y[0],ax,ay+q),d(x[1],y[1],ax,ay+q),d(x[2],y[2],ax,ay+q)) > diff(d(x[0],y[0],ax,ay-q),d(x[1],y[1],ax,ay-q),d(x[2],y[2],ax,ay-q))){
			ax -= q;
		}
		else if(diff(d(x[0],y[0],ax,ay+q),d(x[1],y[1],ax,ay+q),d(x[2],y[2],ax,ay+q)) < diff(d(x[0],y[0],ax,ay-q),d(x[1],y[1],ax,ay-q),d(x[2],y[2],ax,ay-q))){
			ax += q;
		}
		if(q<0.0001) break;

		q /= 2;
		}
	}

	r = d(x[0],y[0],ax,ay);

	printf("%.3f %.3f %.3f\n",ax, ay, r);

}
	return 0;
}

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

using namespace std;

typedef complex<double> Point;

bool eqv(double d1, double d2) {
    return abs(d1-d2) < 1e-4;
}

double r_(double x) {
    if(abs(x) < 0.001) return 0;
    return x;
}

int main() {
    int N;

    cin >> N;
    while(N--) {
        double x1, x2, x3, y1, y2, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        Point p1(x1, y1), p2(x2, y2), p3(x3, y3);

        double R = abs(abs(p3-p2) / sin(arg(p2-p1) - arg(p3-p1))) / 2;
        Point pc1 = (p1+p2) / 2.;
        Point ph1 = (pc1-p1) * Point(0, 1);
        Point pc2 = (p1+p3) / 2.;
        Point ph2 = (pc2-p1) * Point(0, 1);

        //pc1 + k*ph1 == pc2 + l*ph2
        //pc1-pc2 == l*ph2 - k*ph1
        //d = pc1-pc2
        //l*ph2.x - k*ph1.x == d.x
        //l*ph2.y - k*ph1.y == d.y
        Point d = pc1-pc2;
        double det = ph2.real()*-ph1.imag() + ph1.real()*ph2.imag();
        double l = (d.real()*-ph1.imag() - d.imag()*ph2.imag()) / det;
        double k = (d.real()*ph1.real() + d.imag()*ph2.real()) / det;
        Point center = pc1 + ph1 * k;

        printf("%.3f %.3f %.3f\n", r_(center.real()), r_(center.imag()), r_(R));
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>

int main()
{
    using namespace std;
    int n;

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

        double const a = sqrt( pow( x2 - x3, 2 ) + pow( y2 - y3, 2 ) );
        double const b = sqrt( pow( x3 - x1, 2 ) + pow( y3 - y1, 2 ) );
        double const c = sqrt( pow( x3 - x2, 2 ) + pow( y3 - y2, 2 ) );

        double const r
            = a * b * c
            / sqrt( ( a + b + c ) * ( -a + b + c ) * ( a - b + c ) * ( a + b - c ) );
        
        double const p
            = ( ( 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 const q
            = ( ( 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 ) );

        cout << showpoint << setprecision( 4 );
        cout << p << " " << q << " " << r << endl;

    }
}

C++: int main(){
    int cnt;
    cin >> cnt;
   ??? double x1, y1, x2, y2, x3, y3;
    ???double a1, a2, b1, b2, c1, c2;
    ???double xp, yp, r;

    while (cnt > 0 && cin >> 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;
        xp = (double)(b1*c2 - b2*c1) / (a1*b2 - a2*b1);
        yp = (double)(c1*a2 - c2*a1) / (a1*b2 - a2*b1);

        r = hypot(xp - x1, yp - y1);
 
        printf("%.3f %.3f %.3f\n", xp,yp,r);
    }
    return 0;
}

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

int main(){
	int n;
	double x1,x2,x3,y1,y2,y3,px,py,r,a,b,c,d,e,f;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		a = (x2-x1)*2.0;
        b = (y2-y1)*2.0;
        c = (x2*x2 + y2*y2 - x1*x1 - y1*y1);
        d = (x3-x1)*2.0;
        e = (y3-y1)*2.0;
        f = (x3*x3 + y3*y3 - x1*x1 - y1*y1);
        px = (c*e-b*f)/(a*e-b*d);
        py = (a*f-c*d)/(a*e-b*d);
        r = sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1));
        printf("%.3f %.3f %.3f\n",px,py,r);
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;

double round(double x){
	if(x > 0) return floor(x + 0.5);
	else return -1.0 * floor(fabs(x) + 0.5);
}

int main()
{
	int n;
	double x1,y1,x2,y2,x3,y3,x,y,r;
	double det,a1,b1,a2,b2,c1,c2;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a1 = 2 * (x1 - x2), b1 = 2 * (y1 - y2);
		a2 = 2 * (x2 - x3), b2 = 2 * (y2 - y3);
		det = a1 * b2 - a2 * b1;
		c1 = (x1*x1 - x2*x2) + (y1*y1 - y2*y2);
		c2 = (x2*x2 - x3*x3) + (y2*y2 - y3*y3);
		x = (a1 * c1 + b1 * c2) / det;
		y = (a2 * c1 + b2 * c2) / det;
		r = sqrt((x - x1)*(x - x1) + (y - y1)*(y - y1));
		x = round(x * 1000) / 1000;
		y = round(y * 1000) / 1000;
		r = round(r * 1000) / 1000;
		if(fabs(x) < 1e-8) x = 0.0;
		if(fabs(y) < 1e-8) y = 0.0;
		if(fabs(r) < 1e-8) r = 0.0;
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

C++: #include<complex>
#include<stdio.h>
#define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c)
int main(){typedef double D;int n;D d,e,f,g,h,i;for(scanf("%d",&n);n--;){scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);std::complex<D> a(d,g),b(e,h),c(f,i);D A=abs(b-c),B=abs(c-a),C=abs(a-b),L=F(A,B,C),s=sin(2*L),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(L)/2);}}