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

// ax + by = e1
// cx + dy = e2
auto solve (double a , double b , double c , double d , double e1 , double e2) -> std::pair <double , double>
{
    auto delta = a * d - b * c;
    auto x = (d * e1 - b * e2) / delta;
    auto y = (a * e2 - c * e1) / delta;
    return std::make_pair (std::move (x) , std::move (y));
}

auto distance (const std::pair <double , double> & a , const std::pair <double , double> & b) -> double
{
    auto dx = a.first  - b.first;
    auto dy = a.second - b.second;
    return std::sqrt (dx * dx + dy * dy);
}

auto show (double v) -> std::string
{
    if (-0.0005 < v && v < 0.0005)
    {
        return "0.000";
    }
    char s [100];
    std::sprintf (s , "%.3f" , v);
    return s;
}

auto main () -> int
{
    int n;
    std::cin >> n;
    for (auto i = 0; i < n; ++ i)
    {
        double x1 , y1 , x2 , y2 , x3 , y3;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        auto b1 = (y2 - y1) * (y1 + y2) / 2 + (x2 - x1) * (x1 + x2) / 2;
        auto b2 = (y3 - y1) * (y1 + y3) / 2 + (x3 - x1) * (x1 + x3) / 2;
        auto p = solve ((x2 - x1) , (y2 - y1) , (x3 - x1) , (y3 - y1) , b1 , b2);
        auto r = distance (p , std::make_pair (x1 , y1));
        std::cout << show (p.first) << ' ' << show (p.second) << ' ' << show (r) << std::endl;
    }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
int k;
double x[3], y[3], a, b, c, d, e, f, l , m, n;
cin >> k;
while(k--){
cin>> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
a = 2 * (x[1] - x[0]);
b = 2 * (y[1] - y[0]);
c = ( (x[1]*x[1]) + (y[1]*y[1]) ) -( (x[0]*x[0]) + (y[0]*y[0]) );
d = 2 * (x[2] - x[0]);
e = 2 * (y[2] - y[0]);
f = ( (x[2]*x[2]) + (y[2]*y[2]) ) -( (x[0]*x[0]) + (y[0]*y[0]) );
l = (c*e - f*b) / (a*e - d*b);
m = (c*d - f*a) / (b*d - e*a);
n = sqrt((l - x[0])*(l - x[0]) + (m - y[0])*(m - y[0]));
cout << fixed <<setprecision(3) << l << " " << m << " " << n << endl;
}
}

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

double marume( double x ){
	long long t = x * 1000 + ((x > 0) ? 1 : -1) * 0.5;
	return t/1000.0;
}

int main(){
	int n;
	double tx, ty, x1, y1, x2, y2;
	
	cin >> n;
	while(n--){
		cin >> tx >> ty >> x1 >> y1 >> x2 >> y2;
		x1 -= tx; y1 -= ty;
		x2 -= tx; y2 -= ty;
		
		double dist1 = x1 * x1 + y1 * y1;
		double dist2 = x2 * x2 + y2 * y2;
		x1 *= 2; y1 *= 2;
		x2 *= 2; y2 *= 2;
		
		double detA = x1 * y2 - y1 * x2;
		double detX = dist1 * y2 - y1 * dist1;
		double detY = x1 * dist2 - dist2 * x1;
		double x = detX / detA; //if(x < 0){ x -= 1e-5; } else { x += 1e-5; }
		double y = detY / detA; //if(y < 0){ y -= 1e-5; } else { y += 1e-5; }
		double r = hypot(x, y) + 1e-7;
		
		x += tx;
		y += ty;
		
		x = marume(x);
		y = marume(y);
		r = marume(r);
		printf("%.3Lf %.3Lf %.3Lf\n", x, y, r);
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>

int main(void){
	int n;
	double x1, y1, x2, y2, x3, y3;
	double r, xp, yp;

	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

		xp = (1/2.0) * ((x1*x1 + y1*y1)*(y3 - y2) + (x2*x2 + y2*y2)*(y1 - y3) + (x3*x3 + y3*y3)*(y2 - y1)) / (x1*(y3 - y1) + x2*(y1 - y3) + x3*(y2 - y1));
		yp = -(x3 - x2)/(y3 - y2) * xp + (1/2.0) * (x3*x3 - x2*x2 + y3*y3 - y2*y2) / (y3 - y2);
		r = sqrt((x1 - xp)*(x1 - xp) + (y1 - yp)*(y1 - yp));

		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}

	return 0;
}

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

using namespace std;

int main() {
    int n;
    double x1, x2, x3, y1, y2, y3;
    double a, b, c, sinA, xa, ya, r;
    double cosA, cosB, cosC;

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

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

        cosA = (pow(b, 2) + pow(c, 2) - pow(a, 2)) / (2 * b * c);
        cosB = (pow(c, 2) + pow(a, 2) - pow(b, 2)) / (2 * c * a);
        cosC = (pow(a, 2) + pow(b, 2) - pow(c, 2)) / (2 * a * b);

        sinA = sqrt(1.0 - pow(cosA, 2));

        xa = (a * cosA * x1 + b * cosB * x2 + c * cosC * x3) / (a * cosA + b * cosB + c * cosC);
        ya = (a * cosA * y1 + b * cosB * y2 + c * cosC * y3) / (a * cosA + b * cosB + c * cosC);
        r = a / (2.0 * sinA);

        cout << fixed << setprecision(3) << xa << " " << ya << " " << r << endl;
    }
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
long n,i;
double x1,y1,x2,y2,x3,y3,Px,Py,r,a1,b1,c1,a2,b2,c2;
cin>>n;
for(i=0;i<n;i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
a1=(x2-x1)*2;
b1=(y2-y1)*2;
c1=x1*x1-x2*x2+y1*y1-y2*y2;
a2=(x3-x1)*2;
b2=(y3-y1)*2;
c2=x1*x1-x3*x3+y1*y1-y3*y3;
Px=(b1*c2-b2*c1)/(a1*b2-a2*b1);
Py=(c1*a2-c2*a1)/(a1*b2-a2*b1);
r=sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));
printf("%.3f %.3f %.3f\n",Px,Py,r);
}
return 0;
}

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

using namespace std;

typedef complex<double> Point;
#define sq(x) (pow((x), (2.0)))
#define X real()
#define Y imag()

class Triangle{
    private:
        Point a, b, c;
        double edgeA, edgeB, edgeC;
        double angleA, angleB, angleC;
        double getAngle(double a, double b, double c){
            return acos((sq(b) + sq(c) - sq(a)) / (2.0 * b * c));
        }
    public:
        Triangle(Point p1, Point p2, Point p3){
            a = p1;
            b = p2;
            c = p3;
            edgeA = abs(b - c);
            edgeB = abs(a - c);
            edgeC = abs(a - b);
            angleA = getAngle(edgeA, edgeB, edgeC);
            angleB = getAngle(edgeB, edgeC, edgeA);
            angleC = getAngle(edgeC, edgeA, edgeB);
        }
        double circleRadius(){
            return (edgeA / sin(angleA)/ 2.0);
        }
        double circleX(){
            double A = sin(2.0 * angleA);
            double B = sin(2.0 * angleB);
            double C = sin(2.0 * angleC);
            return ((a.X * A + b.X * B + c.X * C) / (A+B+C));
        }
        double circleY(){
            double A = sin(2.0 * angleA);
            double B = sin(2.0 * angleB);
            double C = sin(2.0 * angleC);
            return ((a.Y * A + b.Y * B + c.Y * C) / (A+B+C));
        }
};

int main(){
    int n;
    double x1, y1, x2, y2, x3, y3;
    double r, xp, yp;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i){
        scanf("%lf %lf %lf %lf %lf %lf",
                &x1, &y1, &x2, &y2, &x3, &y3);
        Point a(x1, y1);
        Point b(x2, y2);
        Point c(x3, y3);
        Triangle T(a, b, c);
        r = T.circleRadius();
        xp = T.circleX();
        yp = T.circleY();
        printf("%.3f %.3f %.3f\n", xp, yp, r);
    }
    return 0;
}