Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
   int n;
   cin>>n;
   while(n--){
       double x1,x2,x3,y1,y2,y3;
       double px,py,r;
       scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
       double a1=(x2*x2+y2*y2-x1*x1-y1*y1)*(y3-y1);
       double b1 =(x3*x3+y3*y3-x1*x1-y1*y1)*(y2-y1);
        double a2 =(x3*x3+y3*y3-x1*x1-y1*y1)*(x2-x1);
        double b2 =(x2*x2+y2*y2-x1*x1-y1*y1)*(x3-x1);
        double c = (x2-x1)*(y3-y1)-(y2-y1)*(x3-x1);
        px=(a1-b1)/c/2;
        py=(a2-b2)/c/2;
        r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
        printf("%.3f %.3f %.3f\n",px,py,r);
   }
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    while(n--){
        float x1,y1,x2,y2,x3,y3;
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        float p1,p2,p3;
        p1 = (max((fabs(x1 - x2),fabs(x1 - x3)),fabs(x2 - x3))) / 2.000;
        p2 = (max((fabs(y1 - y2),fabs(y1 - y3)),fabs(y2 - y3))) / 2.000;
        p3 = sqrt((p1 - x1) * (p1 - x1) + (p2 - y1) * (p2 - y1));
        printf("%4.3f %4.3f %4.3f",p1,p2,p3);
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
class Point {
public:
	double x, y;
};
double distance(Point x, Point y) {
	return pow(pow(fabs(x.x - y.x), 2) + pow(fabs(x.y - y.y), 2), 0.5);
}
int main() {
	cout << setprecision(4);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		Point p[3], s;
		for (int i = 0; i < 3; i++) {
			cin >> p[i].x >> p[i].y;
		}
		double a, b, c, d, e, f;
		a = (-2)*p[0].x + 2 * p[1].x;
		b = (-2)*p[0].y + 2 * p[1].y;
		c = (-2)*p[0].x + 2 * p[2].x;
		d = (-2)*p[0].y + 2 * p[2].y;
		e = pow(p[0].x, 2) + pow(p[0].y, 2) - pow(p[1].x, 2) - pow(p[1].y, 2);
		f = pow(p[0].x, 2) + pow(p[0].y, 2) - pow(p[2].x, 2) - pow(p[2].y, 2);
		s.x = (b*f - d*e) / (a*d - b*c);
		s.y = (a*f - c*e) / (b*c - a*d);
		double k = distance(p[0], s);
		s.x = round(s.x * 1000) / 1000;
		s.y = round(s.y * 1000) / 1000;
		k = round(k * 1000) / 1000;
		cout << s.x << " " << s.y << " " << k << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int n;
double xa, ya, xb, yb, xc, yc, x, y, r;

signed main() {
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> xa >> ya >> xb >> yb >> xc >> yc;
		x = ((ya-yb)*(xc*xc+yc*yc-xa*xa-ya*ya)-(ya-yc)*(xb*xb+yb*yb-xa*xa-ya*ya))/(2*((ya-yc)*(xa-xb)-(ya-yb)*(xa-xc)));
		y = ((xa-xb)*(xc*xc+yc*yc-xa*xa-ya*ya)-(xa-xc)*(xb*xb+yb*yb-xa*xa-ya*ya))/(2*((ya-yb)*(xa-xc)-(ya-yc)*(xa-xb)));
		r = sqrt((x-xa)*(x-xa)+(y-ya)*(y-ya));
		printf("%.3lf %.3lf %.3lf\n",x,y,r);
	}
}

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

struct TPoint
{
    double x;
    double y;
};
struct TTriangle
{
    TPoint p1;
    TPoint p2;
    TPoint p3;
};
void SolveEquation(double a, double b, double c, double d, double e, double f, double* x, double* y)
{
    *y = (f - d * c / a)/( e - d * b / a);
    *x = (c - b * *y) / a;
}
/*
A(a, b) B(c, d) C(e, f)
(OA)^2 = (OB)^2
(OA)^2 = (OC)^2
x2-2ax+a2 + y2-2by+b2 = x2-2cx+c2 + y2-2dy+d2
(2c-2a)x + (2d-2b)y = c^2 + d^2 - a^2 - b^2;

x2-2ax+a2 + y2-2by+b2 = x2-2ex+e2 + y2-2fy+f2
(2e-2a)x + (2f-2b)y = e^2 + f^2 - a^2 - d^2
*/
TPoint GetCentral(const TTriangle& Tri)
{
    using std::pow;
    double a, b, c, d, e, f;
    a = 2 * (Tri.p2.x - Tri.p1.x);
    b = 2 * (Tri.p2.y - Tri.p1.y);
    c = pow(Tri.p2.x,2) + pow(Tri.p2.y,2) - pow(Tri.p1.x,2) - pow(Tri.p1.y,2);
    d = 2 * (Tri.p3.x - Tri.p1.x);
    e = 2 * (Tri.p3.y - Tri.p1.y);
    f = pow(Tri.p3.x,2) + pow(Tri.p3.y,2) - pow(Tri.p1.x,2) - pow(Tri.p1.y,2);
    TPoint P;
    SolveEquation(a, b, c, d, e, f, &P.x, &P.y);
    return P;
}
double GetLength(const TPoint& A, const TPoint& B)
{
    // return std::sqrt(std::pow(A.x - B.x, 2) + std::pow(A.y - B.y, 2));
    return std::sqrt((A.x - B.x)*(A.x - B.x) + (A.y - B.y)*(A.y - B.y));
}
double GetRadius(double a, double b, double c)
{
    return (a*b*c)/std::sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
}
double GetRadius(const TTriangle& Tri)
{
    double a = GetLength(Tri.p1, Tri.p2);
    double b = GetLength(Tri.p2, Tri.p3);
    double c = GetLength(Tri.p3, Tri.p1);
    return GetRadius(a, b, c);
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i){
        // double a, b, c;
        // std::cin >> a >> b >> c;
        // std::cout << GetRadius(a, b, c) << std::endl;
        
        TTriangle tri;
        std::cin >> tri.p1.x >> tri.p1.y >> tri.p2.x >> tri.p2.y >> tri.p3.x >> tri.p3.y;
        TPoint C = GetCentral(tri);
        double r = GetRadius(tri);
        std::cout << std::fixed << std::setprecision(3);
        std::cout << C.x << " " << C.y << " " << r << std::endl;
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#include<math.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    double x1, y1, x2, y2, x3, y3;
    double a1, a2, b1, b2, c1, c2;
    double xans, yans, r;
    int n;

    cin >> n;
    rep(i,n){
        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;
        xans = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        yans = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        r = sqrt( (x1 - xans) * (x1 - xans) + (y1 - yans) * (y1 - yans) );
        cout << fixed;
        cout << setprecision(3) << xans + 0.0005 << " " << setprecision(3) << yans + 0.0005 << " " << setprecision(3) << r + 0.0005 << endl;
    }
}

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

using namespace std;

struct point{
    double x;
    double y;
};

int main(){
    int n;
    struct point points[3];

    cin>>n;
    for (int j = 0; j < n; ++j) {
        double s,a,b,c;
        for (int i = 0; i < 3; ++i) {
            cin >> points[i].x >> points[i].y;
        }
        a  = sqrt(pow(points[0].x-points[1].x,2)+pow(points[0].y-points[1].y,2));
        b  = sqrt(pow(points[1].x-points[2].x,2)+pow(points[1].y-points[2].y,2));
        c  = sqrt(pow(points[2].x-points[0].x,2)+pow(points[2].y-points[0].y,2));
        s  = (a+b+c)/2;
        printf("%.3f %.3f %.3f\n",
               ((points[0].y - points[2].y)*(pow(points[0].y,2) - pow(points[1].y,2) + pow(points[0].x,2) - pow(points[1].x,2)) - (points[0].y - points[1].y)*(pow(points[0].y,2) - pow(points[2].y,2) + pow(points[0].x,2) - pow(points[2].x,2))) / (2*(points[0].y - points[2].y)*(points[0].x - points[1].x) - 2*(points[0].y - points[1].y)*(points[0].x - points[2].x))+5e-5,
               ((points[0].x - points[2].x)*(pow(points[0].x,2) - pow(points[1].x,2) + pow(points[0].y,2) - pow(points[1].y,2)) - (points[0].x - points[1].x)*(pow(points[0].x,2) - pow(points[2].x,2) + pow(points[0].y,2) - pow(points[2].y,2))) / (2*(points[0].x - points[2].x)*(points[0].y - points[1].y) - 2*(points[0].x - points[1].x)*(points[0].y - points[2].y))+5e-5,
               a*b*c/(4*sqrt(s*(s-a)*(s-b)*(s-c)))+5e-5
        );
    }
    return 0;
}