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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double, int>;
using ld = long double;

constexpr ld eps = 1e-8;

namespace geometry2d {


using point = std::complex<long double>;

bool eq(long double a, long double b) {
    return (std::abs(a-b) < eps);
}


long double dot(point a, point b) {
    return std::real(std::conj(a) * b);
}

long double cross(point a, point b) {
    return std::imag(std::conj(a) * b);
}


class segment {
public:
    segment()
        : a(point(0, 0)),
          b(point(0, 0))
    {}
    segment(point a_, point b_)
        : a(a_), b(b_)
    {}

    point a, b;
};

class line {
public:
    line()
        : a(point(0, 0)), b(point(0, 0))
    {}
    line(point a_, point b_)
        : a(a_), b(b_)
    {}
    line(segment s)
        : a(s.a), b(s.b)
    {}

    point a, b;
};

class circle {
public:
    circle()
        : p(point(0, 0)), r(0)
    {}
    circle(point p_, long double r_)
        : p(p_), r(r_)
    {}

    point p;
    long double r;
};


int ccw(point a, point b, point c) {
    b -= a; c -= a;
    if(cross(b, c) > eps)           return 1;  // a -> b -> c : counterclockwise
    if(cross(b, c) < -eps)          return -1; // a -> b -> c : clockwise
    if(dot(b, c) < 0)               return 2;  // c -> a -> b : line
    if(std::norm(b) < std::norm(c)) return -2; // a -> b -> c : line
    return 0;                                  // a -> c -> b : line
}


bool isis_ll(line l, line m) {
    return !eq(cross(l.b - l.a, m.b - m.a), 0);
}

bool isis_ls(line l, segment s) {
    return (cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - s.a) < eps);
}

bool isis_lp(line l, point p) {
    return (std::abs(cross(l.b - p, l.a - p)) < eps);
}

bool isis_sp(segment s, point p) {
    return (std::abs(s.a - p) + std::abs(s.b - p) - std::abs(s.b - s.a) < eps);
}

bool isis_ss(segment s, segment t) {
    return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0
        && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}


point proj(line l, point p) {
    long double t = dot(p - l.a, l.a - l.b) / std::norm(l.a - l.b);
    return l.a + t * (l.a - l.b);
}

point is_ll(line s, line t) {
    point sv = s.b - s.a, tv = t.b - t.a;
    assert(cross(sv, tv) != 0);
    return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

long double dist_lp(line l, point p) {
    return std::abs(p - proj(l, p));
}

long double dist_ll(line l, line m) {
    return isis_ll(l, m) ? 0 : dist_lp(l, m.a);
}

long double dist_ls(line l, segment s) {
    return isis_ls(l, s) ? 0 : std::min(dist_lp(l, s.a), dist_lp(l, s.b));
}

long double dist_sp(segment s, point p) {
    point r = proj(line(s), p);
    return isis_sp(s, r) ? std::abs(r - p) : std::min(std::abs(s.a - p), std::abs(s.b - p));
}

long double dist_ss(segment s, segment t) {
    if(isis_ss(s, t)) return 0;
    long double d1 = std::min(dist_sp(s, t.a), dist_sp(s, t.b));
    long double d2 = std::min(dist_sp(t, s.a), dist_sp(t, s.b));
    return std::min(d1, d2);
}


std::vector<point> is_cc(circle const& c1, circle const& c2) {
    std::vector<point> res;
    long double d = std::abs(c1.p - c2.p);
    long double rc = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
    long double dfr = c1.r * c1.r - rc * rc;
    if(std::abs(dfr) < eps) {
        dfr = 0.0;
    } else if(dfr < 0.0) {
        return res;
    }

    long double rs = std::sqrt(dfr);
    point diff = (c2.p - c1.p) / d;
    res.push_back(c1.p + diff * point(rc, rs));
    if(dfr != 0.0) {
        res.push_back(c1.p + diff * point(rc, -rs));
    }
    return res;
}


} // namespace geometry2d

using namespace geometry2d;


int main() {
    int n;
    cin >> n;
    while(n--) {
        vector<point> v(3);
        for(int i=0; i<3; ++i) {
            ld x, y;
            cin >> x >> y;
            v[i] = point(x, y);
        }
        line l1, l2;
        l1.a = (v[0] + v[1]) * 0.5L;
        l1.b = l1.a + (v[0] - v[1]) * point(0, 1);
        l2.a = (v[0] + v[2]) * 0.5L;
        l2.b = l2.a + (v[0] - v[2]) * point(0, 1);
        point res = is_ll(l1, l2);
        cout << fixed << setprecision(3) << real(res) << ' ' << imag(res) << ' ' << abs(res - v[0]) << endl;
    }
}

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

typedef complex<double> point;

#define PI M_PI
#define EPS (1e-10)
#define X real()
#define Y imag()

class Triangle{
private:	
	point a,b,c;
	double edgeA,edgeB,edgeC;
	double angleA,angleB,angleC;
	double calc_angle(double a,double b, double c){
		return acos((b*b+c*c-a*a)/(2.0*b*c));
	}
	bool equal(double a, double b){
		return (abs(a-b) < EPS)? true: false;
	}

public:
	Triangle(point p1,point p2,point p3){
		a=p1; b=p2; c=p3;
		edgeA=abs(b-c);
		edgeB=abs(c-a);
		edgeC=abs(a-b);
		angleA=calc_angle(edgeA,edgeB,edgeC);
		angleB=calc_angle(edgeB,edgeC,edgeA);
		angleC=calc_angle(edgeC,edgeA,edgeB);
	}
	double circumscribed_radius(){
		return (edgeA/(2.0*sin(angleA)));
	}
	double circumscribed_X(){
		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 circumscribed_Y(){
		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(void){
	double x1,y1;
	double x2,y2;
	double x3,y3;
	int n;
	double r,px,py;

	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		point p1(x1,y1);
		point p2(x2,y2);
		point p3(x3,y3);
		Triangle Tr(p1,p2,p3);
		r=Tr.circumscribed_radius();
		px=Tr.circumscribed_X();
		py=Tr.circumscribed_Y();
		cout << fixed;
		cout.precision(3);
		cout << px << " " << py << " " << r << endl;
		if(i==20) break;
	}
	return 0;
}

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

using namespace std;

int n;
double x[3], y[3];

int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
		double a1 = 2.0 * (x[1] - x[0]);
		double b1 = 2.0 * (y[1] - y[0]);
		double c1 = x[0]*x[0] - x[1]*x[1] + y[0]*y[0] - y[1]*y[1];
		double a2 = 2.0 * (x[2] - x[0]);
		double b2 = 2.0 * (y[2] - y[0]);
		double c2 = x[0]*x[0] - x[2]*x[2] + y[0]*y[0] - y[2]*y[2];

		double cx = (b1*c2-b2*c1) / (a1*b2-a2*b1);
		double cy = (c1*a2-c2*a1) / (a1*b2-a2*b1);
		
		double dx = x[0] - cx;
		double dy = y[0] - cy;
		double r = sqrt(dx*dx + dy*dy);
		
		printf("%.3f %.3f %.3f\n", cx, cy, r);
	}
}