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 <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 point_distance(point s, point e){
	double d;
	d = (e.x - s.x)*(e.x - s.x) + (e.y - s.y)*(e.y - s.y);
	d = sqrt(d);
	return d;
}

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

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

	cin >> n;
	vector<point> *v = new vector<point>[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 << setprecision(3);
		cout << setiosflags(ios::fixed);
		cout << cp.x << ' ' << cp.y << ' ' << r << endl;
	}
	return 0;
}

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

#define ROUND_RANK 4
#define EPS 1e-8

using namespace std;

struct vec2
{
	double x;
	double y;
};

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& p11, const double& q2, const double& q1, const double& p21) {
	return ((p11*q2 - q1*p21) / det);
}
//rの解の算出
double Calc_r(const double& x0, const double& y0, const double& x1, const double& y1) {
	double r;
	r = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
	return r;
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	int n;
	vec2 ver[20][3];
	double p11, p12, p21, p22, q1, q2;
	double  det;//行列式
	double	x, y, r;//解

	cin >> n;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> ver[i][j].x;
			cin >> ver[i][j].y;
		}
		p11 = -2 * (ver[i][0].x - ver[i][1].x);
		p12 = -2 * (ver[i][0].y - ver[i][1].y);
		p21 = -2 * (ver[i][1].x - ver[i][2].x);
		p22 = -2 * (ver[i][1].y - ver[i][2].y);
		q1 = (ver[i][1].x + ver[i][0].x)*(ver[i][1].x - ver[i][0].x)
			+ (ver[i][1].y + ver[i][0].y)*(ver[i][1].y - ver[i][0].y);
		q2 = (ver[i][2].x + ver[i][1].x)*(ver[i][2].x - ver[i][1].x)
			+ (ver[i][2].y + ver[i][1].y)*(ver[i][2].y - ver[i][1].y);
		det = Calc_det(p11, p12, p21, p22);
		det = fabs(det);
		x = Calc_x(det, q1, p22, p12, q2);
		y = Calc_y(det, p11, q2, q1, p21);
		r = Calc_r(x, y, ver[i][0].x, ver[i][0].y);
		x = Round(x, ROUND_RANK);
		y = Round(y, ROUND_RANK);
		r = Round(r, ROUND_RANK);
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x + EPS << " " << y + EPS << " " << r + EPS << endl;
	}
}

C++: #include <cstdio>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-5;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac & bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(a.Y, a.X);
  return b;
}

int main() {
  int n;
  scanf("%d", &n);
  REP(j, n) {
    VP a;
    REP(i, 3) {
      double x,y;
      scanf("%lf %lf", &x, &y);
      a.push_back(P(x,y));
    }
    P M = (a[0]+a[1])/(P)2;
    P N = (a[1]+a[2])/(P)2;
    P M_v = normal_vector(a[0]-a[1]);
    P N_v = normal_vector(a[1]-a[2]);  
    P o = crosspoint(M, N, M+M_v, N+N_v);
    
    printf("%.3lf %.3lf %.3lf\n", o.X, o.Y, distPP(o,a[0]));
    a.clear();
  }
  return 0;
}