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

using namespace std;

struct point{
    double x;
    double y;
};

struct linear{
    double a;
    double b;
    double c;
};

linear get_linear(point a, point b){
    linear l;

    if(a.x == b.x){
        l.a = 1;
        l.b = 0;
        l.c = a.x;
    }else if(a.y == b.y){
        l.a = 0;
        l.b = 1;
        l.c = a.y;
    }else{
        l.a = (b.x-a.x)/(b.y-a.y);
        l.b = -1;
        l.c = a.x * l.a - a.y;
    }
    return l;
}

linear get_linear_vertical(point p, linear l){
    linear lv;
    lv.a = (-1)*l.b;
    lv.b = l.a;
    lv.c = lv.a*p.x + lv.b*p.y;
    return lv;
}

point get_cross_point(linear l1, linear l2){
    point p;
    p.x = (l1.b*l2.c - l1.c*l2.b)/(l1.b*l2.a - l1.a*l2.b);
    p.y = (l1.c*l2.a - l1.a*l2.c)/(l1.b*l2.a - l1.a*l2.b);
    return p;
}

double round3dig(double d){
    d += 0.0005;
    d *= 1000;
    d = int(d);
    if(d != 0)
        d /= 1000;
    return d;
}

double point_distance(point s, point e){
    double d;
    d = pow(e.x - s.x, 2)+pow(e.y - s.y, 2);
    d = sqrt(d);
    return d;
}

int main()
{
    int n;
    double r;
    point p[3], mp, cp;
    linear l1, l2;

    cin >> n;
    vector< point > v[n];
    for(int i = 0; i < n; ++i){
        cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y;
        v[i].push_back(p[0]);
        v[i].push_back(p[1]);
        v[i].push_back(p[2]);
    }
    for(int i = 0; i < n; ++i){
        l1 = get_linear(v[i].at(0), v[i].at(1));
        mp.x = (v[i].at(1).x - v[i].at(0).x)/2;
        mp.y = (v[i].at(1).y - v[i].at(0).y)/2;
        l1 = get_linear_vertical(mp, l1);

        l2 = get_linear(v[i].at(0), v[i].at(2));
        mp.x = (v[i].at(2).x - v[i].at(0).x)/2;
        mp.y = (v[i].at(2).y - v[i].at(0).y)/2;
        l2 = get_linear_vertical(mp, l2);

        cp = get_cross_point(l1, l2);
        r = point_distance(v[i].at(0), cp);

        cp.x = round3dig(cp.x);
        cp.y = round3dig(cp.y);
        r = round3dig(r);

        cout << fixed << setprecision(3)
             << cp.x << ' ' << cp.y << ' ' << r << endl;
    }
    return 0;
}

C++: include<iostream>
#include<cmath>
using namespace std;
int main() {
  int n=0;
  double ax,ay,bx,by,cx,cy,S,R,a,b,c,x=0,y=0;
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>ax>>ay>>bx>>by>>cx>>cy;
    S=((bx-ax)*(cy-ay)-(cx-ax)*(by-ay))/2;
    a=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
    b=sqrt((cx-bx)*(cx-bx)+(cy-by)*(cy-by));
    c=sqrt((ax-cx)*(ax-cx)+(ay-cy)*(ay-cy));
    R=a*b*c/(4*S);
    x=(a*a*(b*b+c*c-a*a)*ax+b*b*(c*c+a*a-b*b)*bx+c*c*(a*a+b*b-c*c)*cx)/(16*S*S);
    y=(a*a*(b*b+c*c-a*a)*ay+b*b*(c*c+a*a-b*b)*by+c*c*(a*a+b*b-c*c)*cy)/(16*S*S);
    cout<<x<<" "<<y<<" "<<R<<endl;
  }
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <complex>
using namespace std;
typedef complex<double > P;

P getCircumcenter(P a,P b,P c){
	double A1 = 2 * ( b.real() - a.real() );
	double B1 = 2 * ( b.imag() - a.imag() );
	double C1 = pow(a.real(),2)-pow(b.real(),2) + pow(a.imag(),2)-pow(b.imag(),2);
	double A2 = 2 * ( c.real() - a.real() );
	double B2 = 2 * ( c.imag() - a.imag() );
	double C2 = pow(a.real(),2)-pow(c.real(),2) + pow(a.imag(),2)-pow(c.imag(),2);
	double X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1);
	double Y = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1);
	return P(X,Y);
}
int main(){
	int n;
	cin >> n;
	P a,b,c;
	while(n--){
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag();
		P ans = getCircumcenter(a,b,c);
		printf("%.3f %.3f %.3f\n",ans.real(),ans.imag(),abs(ans-a));
	}
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    vector<tuple<pair<double, double>, pair<double, double>, pair<double, double>>> triangles;
    int n;
    cin >> n;
    REP(i, 0, n) {
        pair<double, double> a, b, c;
        cin >> a.first >> a.second >> b.first >> b.second >> c.first >> c.second;
        tuple<pair<double, double>, pair<double, double>, pair<double, double>> triangle(a, b, c);
        triangles.push_back(triangle);
    }

    for (auto tri : triangles) {
        double a1, a2, b1, b2, c1, c2;
        a1 = 2 * (get<1>(tri).first - get<0>(tri).first);
        b1 = 2 * (get<1>(tri).second - get<0>(tri).second);
        c1 = pow(get<0>(tri).first, 2.0) - pow(get<1>(tri).first, 2.0) + pow(get<0>(tri).second, 2.0) - pow(get<1>(tri).second, 2.0);
        a2 = 2 * (get<2>(tri).first - get<0>(tri).first);
        b2 = 2 * (get<2>(tri).second - get<0>(tri).second);
        c2 = pow(get<0>(tri).first, 2.0) - pow(get<2>(tri).first, 2.0) + pow(get<0>(tri).second, 2.0) - pow(get<2>(tri).second, 2.0);

        double x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
        double y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
        double r = sqrt(pow(x-get<0>(tri).first, 2.0) + pow(y-get<0>(tri).second, 2.0));

        cout.setf(ios::fixed, ios::floatfield);
        cout.precision(3);
        cout << x << " " << y << " " << r << endl;
    }

    return 0;
}