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 "bits/stdc++.h"
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)

#define EPS (1e-10)
class P{                    //テァツつケ
public:
	double x,y;
	
	P(double _x=0,double _y=0):x(_x),y(_y){};
	P operator + (const P &p     )const{ return P( x+p.x , y+p.y ); }  //テ・ツ環?ァツョツ?
	P operator - (const P &p     )const{ return P( x-p.x , y-p.y ); }  //テヲツクツ崚ァツョツ?
	P operator * (const double k )const{ return P( x*k   , y*k    ); } //テ、ツケツ療ァツョツ?
	P operator / (const double k )const{ return P( x/k   , y/k    ); } //テゥツ卍、テァツョツ?
	
	bool operator == (const P &p){ return ( fabs(x-p.x)<EPS && fabs(y-p.y)<EPS ); }
	bool operator < (const P &p) const{ return ( x!=p.x ? x<p.x:y<p.y ); }
	
	double norm(){ return x*x+y*y; }        //テ」ツδ偲」ツδォテ」ツδ?
	double abs() { return sqrt(norm()); }   //テ・ツ、ツァテ」ツ?催」ツ??
	void normalize() {double d = sqrt(x*x+y*y); x /= d; y /= d;}	//テヲツュツ」ティツヲツ湘・ツ個?
};
struct C{P p;double r;};    //テ・ツ??
struct S{P p1,p2;};         //テァツキツ堙・ツ按?
typedef vector<P> Polygon;  //テ・ツ、ツ堙ィツァツ津・ツスツ「
typedef P Vector;           //テ」ツδ凖」ツつッテ」ツδ暗」ツδォ
typedef S L;                //テァツ崢エテァツキツ?

double dot  (Vector a,Vector b) { return a.x*b.x+a.y*b.y; }
double cross(Vector a,Vector b) { return a.x*b.y-a.y*b.x; }
double sqDist(P a, P b)         {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}
double dist (P a, P b)          {return sqrt(sqDist(a,b));}
Vector vec(S a)                 {return P(a.p2.x-a.p1.x,a.p2.y-a.p1.y);}


//テァツキツ堙・ツ按?」ツ?ョテ・ツ楪づァツ崢エテ、ツコツ古ァツュツ嘉・ツ按?ァツ崢エテァツキツ堙」ツつ津ヲツアツづ」ツつ?」ツつ?
S getBisector(P a, P b){
	Vector vect = vec(S{a,b});
	P n = P(vect.y, -vect.x);
	n.normalize();
	P cent = (a+b)/2.0;
	return S{cent,cent+n};
}


// テァツ崢エテァツキツ堙」ツ?ィテァツ崢エテァツキツ堙」ツ?ョテ、ツコツ、テァツつケ vefiried AOJ CGL_2
P getCrossPointSS(S l1, S l2){
	double A = cross(vec(l1), vec(l2));
	double B = cross(vec(l1), l1.p2 - l2.p1);
	if(abs(A)<EPS && abs(B)<EPS) return l2.p1; // テ、ツコツ古ァツ崢エテァツキツ堙」ツ?古ゥツ?催」ツ?ェテ」ツ?」テ」ツ?ヲテ」ツ??」ツつ?
	if(abs(A)<EPS) assert(false); // テァツ崢エテァツキツ堙」ツ?古、ツコツ、テ」ツつ湘」ツつ嘉」ツ?ェテ」ツ??
	return l2.p1 + vec(l2) * B / A;
}


int main(){
	int n;
	cin>>n;
	rep(hoge,n){
		vector<P> points(3);
		rep(i,3)cin>>points[i].x>>points[i].y;
		
		vector<S> bisectors(2);
		rep(i,2) bisectors[i] = getBisector(points[i], points[i+1]);
		
		P cent = getCrossPointSS(bisectors[0], bisectors[1]);
		
		
		printf("%.3lf %.3lf %.3lf\n",cent.x,cent.y,dist(cent,points[1]));
	}
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<iomanip>
using namespace std;
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;
 
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
 
class Point{
    public:
        double x, y;
 
        Point(double x = 0, double y = 0): x(x), y(y) {}
 
        Point operator + (Point p){ return Point(x + p.x, y + p.y);}
        Point operator - (Point p){ return Point(x - p.x, y - p.y);}
        Point operator * (double a){ return Point(a * x, a * y);}
        Point operator / (double a){ return Point(x / a, y / a);}
 
        double abs(){ return sqrt(norm());}
        double norm(){ return x * x + y * y;}
 
        bool operator < (const Point &p) const{
            return x != p.x ? x < p.x : y < p.y;
        }
 
        bool operator == (const Point &p) const{
            return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
        }
};
 
struct Segment {
    Point p1, p2;
};
typedef Segment Line;
 
class Circle{
    public:
        Point c;
        double r;
        Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};
 
typedef Point Vector;
typedef vector<Point> Polygon;
 
double dot(Vector a, Vector b){
    return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){
    return a.x * b.y - a.y * b.x;
}
 
Point project(Segment s, Point p){
    Vector base = s.p2 - s.p1;
    double r = dot(p - s.p1, base) / base.norm();
    return s.p1 + base * r;
}
 
Point getCrossPoint(Segment s1, Segment s2){
    Vector base = s2.p2 - s2.p1;
    double d1 = abs(cross(base, s1.p1 - s2.p1));
    double d2 = abs(cross(base, s1.p2 - s2.p1));
    double t = d1 / (d1 + d2);
    return s1.p1 + (s1.p2 - s1.p1) * t;
}
 
double getDistance(Point a, Point b){
    return (a - b).abs();
}
 
pair<Point, Point> getCrossPoints(Circle c, Line l){
    Vector pr = project(l, c.c);
    Vector e = (l.p2 - l.p1) / (l.p2 - l.p1).abs();
    double base = sqrt(c.r * c.r - (pr - c.c).norm());
    return make_pair(pr + e * base, pr - e * base);
}
 
double arg(Vector p){return atan2(p.y, p.x);}
Vector polar(double a, double r){return Point(cos(r) * a, sin(r) * a);}
 
pair<Point, Point> getCrossPoints(Circle c1, Circle c2){
    double d = (c1.c - c2.c).abs();
    double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    double t = arg(c2.c - c1.c);
    return make_pair(c1.c + polar(c1.r, t + a), c1.c + polar(c1.r, t - a));
}
 
int main(){
    int n;
    Point p[3];
    cin >> n;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 3; j++){
            cin >> p[j].x >> p[j].y;
        }
        pair<Point, Point> pp = getCrossPoints((Circle){p[0], 400.0}, (Circle){p[1], 400.0});
        pair<Point, Point> pp2 = getCrossPoints((Circle){p[0], 400.0}, (Circle){p[2], 400.0});
        Point P = getCrossPoint((Line){pp.first, pp.second}, (Line){pp2.first, pp2.second});
        cout << P.x << " " << P.y << " " << getDistance(p[0], P) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
typedef pair<double, double> PDD;
PDD calc(double mat[2][2], double vec[2]){
  double a = mat[0][0], b = mat[0][1], d = mat[1][0], e = mat[1][1];
  double c = vec[0], f = vec[1];
  double det = a * e - d * b;
  return make_pair((e * c - b * f) / det, (-c * d + a * f) / det);
}
int main(){
  int Tc;
  cin >> Tc;
  for(int tc = 0; tc < Tc; ++tc){
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double A, B, C, D, E, F;
    A = (y1 + y3) / 2.;
    B = (x1 - x3) / (y1 - y3);
    C = (x1 + x3) / 2.;
    D = (y2 + y3) / 2.;
    E = (x2 - x3) / (y2 - y3);
    F = (x2 + x3) / 2.;
    double mat[2][2];
    mat[0][0] = B; mat[0][1] = 1;
    mat[1][0] = E; mat[1][1] = 1;
    double vec[2];
    vec[0] = A + B * C;
    vec[1] = D + E * F;
    PDD res = calc(mat, vec);
    double x = res.first, y = res.second;
    double r = pow((x-x1)*(x-x1)+(y-y1)*(y-y1), 0.5);
    x = (double)(round(x*1000))/1000.0;
    y = (double)(round(y*1000))/1000.0;
    r = (double)(round(r*1000))/1000.0;
    printf("%.3f %.3f %.3f\n", x, y, r);
  }
  return 0;
}