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>

struct Point {
	double x, y;
};

double roundDig(double, int);

int main ()
{
	int num;
	Point a, b, c, p, mb, mc;
	double r;

	scanf("%d", &num);
	
	for (int i=0; i<num; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &a.x, &a.y, &b.x, &b.y, &c.x, &c.y);
		double A1 = 2 * (b.x - a.x), B1 = 2 * (b.y - a.y), C1 = a.x*a.x - b.x*b.x + a.y*a.y - b.y*b.y,
			   A2 = 2 * (c.x - a.x), B2 = 2 * (c.y - a.y), C2 = a.x*a.x - c.x*c.x + a.y*a.y - c.y*c.y;
		
		p.x = (B1*C1 - B2*C1) / (A1*B2 - A2*B1);
		p.y = (C1*A2 - C2*A1) / (A1*B2 - A2*B1);
		
		mb.x = (a.x + b.x) / 2; mb.y = (a.y + b.y) / 2;
		mc.x = (a.x + c.x) / 2; mc.y = (a.y + c.y) / 2;
		
		r = sqrt((p.x - a.x)*(p.x - a.x) + (p.y - a.y)*(p.x - a.y));
		 
		printf("%.3lf %.3lf %.3lf\n", roundDig(p.x, 4), roundDig(p.y, 4), roundDig(r, 4));
	}
	
    return 0;
}

double roundDig(double n, int dig)
{
	int multi = pow(10, dig);
	
	return (floor(n*multi + 5) / multi);
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	int n;
	cin >> n;
	rep(i, n){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double vx21, vx31, vy21, vy31, tmp1, tmp2;
		vx21 = (x1 - x2);
		vx31 = (x1 - x3);
		vy21 = (y1 - y2);
		vy31 = (y1 - y3);
		tmp1 = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;
		tmp2 = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;
		
		double x, y, r;
		x = -(vy21 * tmp2 - vy31 * tmp1) / (2.0 * (vy31 * vx21 - vy21 * vx31));
		y = -(vx21 * tmp2 - vx31 * tmp1) / (2.0 * (vx31 * vy21 - vx21 * vy31));
		r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
		
		printf("%.3lf %.3lf %.3lf\n", x, y, r);
		
	}
 
	return 0;
}

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

using namespace std;

#define EPS 1e-9

struct P {
	double x, y;
};

double abs(P p) {
	return sqrt(p.x * p.x + p.y * p.y);
}
double dot(P p1, P p2) {
	return p1.x * p2.x + p1.y * p2.y;
}
double xx(double r) {
	return r*r;
}

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

		P a = (P){ x2 - x1, y2 - y1 };
		P b = (P){ x3 - x2, y3 - y2 };
		P c = (P){ x1 - x3, y1 - y3 };

		double R =  abs(a) / (sqrt(1 - xx(dot(b, c) / abs(b) / abs(c))) * 2);
		double l = sqrt( R*R - xx(abs(c)/2) );
		double gx = (x1+x3)/2, gy = (y1+y3)/2;
		P e = (P){ -c.y/abs(c), c.x/abs(c) };
		P eg = (P){ e.x * l, e.y * l };
		P g1 = (P){ gx + eg.x, gy + eg.y };
		P g2 = (P){ gx - eg.x, gy - eg.y };
		if ( abs(xx(x1-g1.x) + xx(y1-g1.y) - R) < EPS ) gx = g1.x, gy = g1.y;
		else gx = g2.x, gy = g2.y;
		printf("%.3f %.3f %.3f\n", gx, gy, R);
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long int ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

void se(double a, double b, double c, double d, double e, double f,double *x,double *y){
	if (a < 0){
		a = -a;
		b = -b;
		c = -c;
	}
	if (b == -0)b = 0;
	if (d < 0){
		d = -d;
		e = -e;
		f = -f;
	}
	cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << "\n";
	if (a == 0){
		*y = c / b;
		*x = (f - e*(*y)) / d;
	}
	else if (b == 0){
		*x = c / a;
		*y = (f - e*(*x)) / d;
	}
	if (d == 0){
		*y = f / e;
		*x = (c - b*(*y)) / a;
	}
	else if (e == 0){
		*x = f / d;
		*y = (c - a*(*x)) / b;
	}
	else if (a != 0 && b != 0 && d != 0 && e != 0){
		*x = (b*f - c*e) / (b*d - a*e);
		*y = (c*d - a*f) / (b*d - a*e);
	}
}


int main(){
	double x1, y1, x2, y2, x3, y3, px, py, r;
	ll n;
	cin >> n;
	REP(i,n){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		se(2.0*(x1 - x2), 2.0*(y1 - y2),
			pow(x1, 2.0) + pow(y1, 2.0) - pow(x2, 2.0) - pow(y2, 2.0),
			2.0*(x2 - x3), 2.0*(y2 - y3),
			pow(x2, 2.0) + pow(y2, 2.0) - pow(x3, 2.0) - pow(y3, 2.0), &px, &py);
		r = pow(pow(x1 - px, 2.0) + pow(y1 - py, 2.0), 0.5);

		printf("%.3lf %.3lf %.3lf", px, py, r);
	}
}