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<math.h>
#include <iomanip>
using namespace std;
int main() {
	int n;
	cin >> n;

	for (int i = 0;i < n;i++) {
		float x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		float px, py, r;
		float A1, B1, C1, A2, B2, C2;
		A1 = 2 * (x2 - y2);
		B1 = 2 * (y2 - y1);
		C1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
		A2 = 2 * (x3 - x1);
		B2 = 2 * (y3 - y1);
		C2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

		px = (B1*C2 - B2*C1) / (A1*B2 - A2*B1);
		py = (C1*A2 - C2*A1) / (A1*B2 - A2*B1);

		r = sqrt((x1 - px)*(x1 - px) + (y1 - py)*(y1 - py));

		px = round(px * 1000) / 1000;
		py = round(py * 1000) / 1000;
		r = round(r * 1000) / 1000;
		cout << fixed << setprecision(3) << px << " ";
		cout << fixed << setprecision(3) << py << " ";
		cout << fixed << setprecision(3) << r << 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], 200.0}, (Circle){p[1], 200.0});
		pair<Point, Point> pp2 = getCrossPoints((Circle){p[0], 200.0}, (Circle){p[2], 200.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 <iomanip>
#include <cmath>
using namespace std;

double sisya(double x)
{
	int a = static_cast<int>(x * 10000);
	x = static_cast<double>(static_cast<int>(x * 1000)) / 1000;
	if(a < 0)
		a = -a;
	if(a%10 >= 5)
		return x+0.001;
	return x;
}

double dif(double x,double y,double xx, double yy)
{
	return sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy));
}

int main()
{
	int n;
	double x1,x2,x3,y1,y2,y3;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double maxx = max(x1,max(x2,x3));
		double maxy = max(y1,max(y2,y3));
		double minx = min(x1,min(x2,x3));
		double miny = min(y1,min(y2,y3));
		cout << setprecision(3) << fixed << sisya((maxx - minx) / 2 ) << " ";
		cout << setprecision(3) << fixed << sisya((maxy - miny) / 2 ) << " ";
		cout << setprecision(3) << fixed << dif(x1,y1,(maxx - minx)/2,(maxy - miny)/2) << endl;
	}
	return 0;
}