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

using namespace std;

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

    cin >> n;
    for (int i = 0; i < n; i++) {
        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;

        x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));

        cout << setprecision(3) << fixed;
        cout << x << " " << y << " " << r << " " << endl;
    }

    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 <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main(){
int n,i;
double x1,y1,x2,y2,x3,y3,px,py,r;

cin >> n;

for(i=0;i<n;i++){

cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

px=((y1-y3)*(pow(y1,2.0)-pow(y2,2.0) +pow(x1,2.0) -pow(x2,2.0))-(y1-y2)*(pow(y1,2.0) -pow(y3,2.0) +pow(x1,2.0) -pow(x3,2.0))) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
py=((x1-x3)*(pow(x1,2.0) -pow(x2,2.0) +pow(y1,2.0) -pow(y2,2.0)) -(x1-x2)*(pow(x1,2.0) -pow(x3,2.0) +pow(y1,2.0) -pow(y3,2.0))) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));


r=sqrt(pow(x1-px,2.0)+pow(y1-py,2.0));

printf("%.3f %.3f %.3f\n",px,py,r);



}
}

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

using namespace std;

void getSide(double x1, double y1, double x2, double y2, double x3, double y3, double *a, double *b, double *c) {
    double marginX1, marginX2, marginX3;
    double marginY1, marginY2, marginY3;
    
    marginX1 = fabs(x1 - x2);
    marginX2 = fabs(x2 - x3);
    marginX3 = fabs(x3 - x1);
    marginY1 = fabs(y1 - y2);
    marginY2 = fabs(y2 - y3);
    marginY3 = fabs(y3 - y1);
    
    *a = sqrt(pow(marginX1, 2) + pow(marginY1, 2));
    *b = sqrt(pow(marginX2, 2) + pow(marginY2, 2));
    *c = sqrt(pow(marginX3, 2) + pow(marginY3, 2));
    
}

    // 半径取得の処理
double getR(double a, double b, double c) {
    double r, s;
    s = (a + b + c) / 2;
    r = (a * b * c) / (4 * sqrt(s * (s - a) * (s - b) * (s - c)));
    return r;
}

    // 中心座標を求める処理
void getCentralCoodinate(double x1, double y1, double x2, double y2, double x3, double y3, double *xp, double *yp) {
    double a1, b1, c1;
    double a2, b2, c2;
    double marginX1, marginX3;
    double marginY1, marginY3;
    
    *xp = 0;
    *yp = 0;
    
    marginX1 = x2 - x1;
    marginX3 = x3 - x1;
    marginY1 = y2 - y1;
    marginY3 = y3 - y1;
    
    a1 = 2 * marginX1;
    b1 = 2 * marginY1;
    a2 = 2 * marginX3;
    b2 = 2 * marginY3;
    
    c1 = pow(x1, 2) - pow(x2, 2) + pow(y1, 2) - pow(y2, 2);
    c2 = pow(x1, 2) - pow(x3, 2) + pow(y1, 2) - pow(y3, 2);
    
    *xp = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
    *yp = (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1);
}

    // main処理
int main(void) {
    double x1, x2, x3;
    double y1, y2, y3;
    double xp, yp;
    double a, b, c, r;
    int n;
    
    cin >> n;
    while(n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        getSide(x1, y1, x2, y2, x3, y3, &a, &b, &c);
        r = getR(a, b, c);
        getCentralCoodinate(x1, y1 ,x2, y2, x3, y3, &xp, &yp);
        
        cout << setprecision(3);
        cout << setiosflags(ios::fixed);
        cout << xp << " " << yp << " " << r << endl;
    }
    
    return 0;
}