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 <iomanip>
#include <cmath>
int main()
{
  int n;
  std::cin >> n;
  while (n--) {
    double x1, y1, x2, y2, x3, y3, px, py, r;
    std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double c = 2.0 * ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
    px = ((y3 - y1) * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1) +
          (y1 - y2) * (x3 * x3 - x1 * x1 + y3 * y3 - y1 * y1)) / c;
    py = ((x1 - x3) * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1) +
          (x2 - x1) * (x3 * x3 - x1 * x1 + y3 * y3 - y1 * y1)) / c;
    r = sqrt(pow(x1 - px, 2) + pow(y1 - py, 2));
    std::cout << std::fixed << std::setprecision(3) << px << " " <<
      py << " " << r << std::endl;
  }
  return 0;
}

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);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include<iomanip>
#include <math.h>
using namespace std;

struct Circles {
	double x;
	double y;
	double r;
};

Circles countCircle(double x1,double y1, double x2, double y2, double x3, double y3){
	double a = ((y2 - y1)*(y3*y3 - y1 * y1 + x3 * x3 - x1 * x1) - (y3 - y1)*(y2*y2 - y1 * y1 + x2 * x2 - x1 * x1)) / (2.0*((x3 - x1)*(y2 - y1) - (x2 - x1)*(y3 - y1)));
	double b = ((x2 - x1)*(x3*x3 - x1 * x1 + y3 * y3 - y1 * y1) - (x3 - x1)*(x2*x2 - x1 * x1 + y2 * y2 - y1 * y1)) / (2.0*((y3 - y1)*(x2 - x1) - (y2 - y1)*(x3 - x1)));
	double r = sqrt((x1 - a)*(x1 - a) + (y1 - b)*(y1 - b));
	return Circles{ a,b,r };
}


int main() {
	vector<Circles> dst;
	int n;
	double x1, y1, x2, y2, x3, y3;
	cin >> n;
	while (n-->0) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		dst.push_back(countCircle(x1, y1, x2, y2, x3, y3));
	}
	for (vector<Circles>::iterator it = dst.begin(); it < dst.end(); it++) {
		cout.setf(ios::fixed);
		cout << fixed << setprecision(3) << (*it).x << " " << (*it).y << " " << (*it).r << endl;
	}
	return 0;
}

C++: #define EPS 1e-10
using namespace std;    

typedef complex<double> P;

double cross(P a, P b){
  return (a.real()*b.imag() - a.imag()*b.real());
}

int main()
{
  int i,j;
  int n;
  P point[3],ans;

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

    for(j=0;j<3;j++){
      cin >> point[j].real() >> point[j].imag();
    }

    P p01 = point[0] + point[1];
    P p12 = point[1] + point[2];
    P h01 = P(p01.real()/2 , p01.imag()/2);
    P h12 = P(p12.real()/2 , p12.imag()/2);
    P n1 = (point[0] - h01) * P(0,1) + h01;
    P n2 = (point[1] - h12) * P(0,1) + h12;

    ans = n1 + (h01-n1) * cross(h12-n2,n2-n1) / cross(h12-n2,h01-n1);


    printf("%.3lf %.3lf %.3lf\n",real(ans) + EPS,imag(ans) + EPS,abs(point[0]-ans) );
  }
  return 0;
}

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

using namespace std;

int main(void){
	
	int n;
	double x[3]={0},y[3]={0},r,a,b,c,d[2]={0},e[2]={0},f[2]={0},l,m;

	cin>>n;

	for(int i=0;i<n;i++){
		
		a=b=c=r=l=m=0;
		for(int i=0;i<2;i++){
			d[i]=e[i]=f[i]=0;
		}
		for(int i=0;i<3;i++){
			x[i]=y[i]=0;
		}

		cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2];

		a=sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]));	//ツ各ツ陛督づ個陳キツつウ
		b=sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
		c=sqrt((x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]));	
	
		r=a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));			//ツ外ツ静堋円ツづ個板シツ径
		
		d[0]=2*(x[1]-x[0]);
		e[0]=2*(y[1]-y[0]);
		f[0]=x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
		d[1]=2*(x[2]-x[0]);
		e[1]=2*(y[2]-y[0]);
		f[1]=x[0]*x[0]-x[2]*x[2]+y[0]*y[0]-y[2]*y[2];

		l=(e[0]*f[1]-e[1]*f[0])/(d[0]*e[1]-d[1]*e[0]);
		m=(f[0]*d[1]-f[1]*d[0])/(d[0]*e[1]-d[1]*e[0]);

		l=l*1000;
		l=l+0.5;
		l=int(l);
		l=l/1000;

		m=m*1000;
		m=m+0.5;
		m=int(m);
		m=m/1000;

		r=r*1000;
		r=r+0.5;
		r=(int)(r);
		r=r/1000;
		
		printf("%0.3lf %0.3lf %0.3lf\n",l,m,r);
	}
	return 0;
}