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 <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;

const double EPS = 1e-7;
typedef complex<double> P; /* ツ点 */
struct L {                 /* ツ静シツ閉ェ */
	P p, q;
	L(P p, P q) : p(p), q(q) {}
};

double cross(P a, P b) { return imag(conj(a)*b); }

// ツ陳シツ静シaツづ陳シツ静シbツづ個古ーツ点ツづーツ計ツ算ツつキツづゥツ．ツ静ヲツづ可古ーツ債キツ板サツ津ィツつェツ必ツ須ツ．
P crossPointLL(L a, L b){
	double A = cross(a.q-a.p, b.q-b.p);
	double B = cross(a.q-a.p, a.q-b.p);
	return b.p + B/A * (b.q-b.p);
}

// ツ点pツづ点qツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづーツ陛板つキ
L pointBisector(P p, P q) {
	P cen = (p+q)*0.5;
	return L(cen, cen+(q-p)*P(0,1));
}

int main(){
	int n;
	cin>>n;
	double x1, y1, x2, y2, x3, y3;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3){
		P p1 = P(x1, y1);
		P p2 = P(x2, y2);
		P p3 = P(x3, y3);
		L l1 = pointBisector(p1, p2);
		L l2 = pointBisector(p2, p3);
		P c = crossPointLL(l1, l2);
		double r = abs(p1-c);
		int x1000 = 1000*c.real()+0.5;
		int y1000 = 1000*c.imag()+0.5;
		int r1000 = 1000*r+0.5;
		printf("%.3f %.3f %.3f", 1.0*x1000/1000, 1.0*y1000/1000, 1.0*r1000/1000);
		cout<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

typedef complex<double> P;

/*
 // a1,a2ツづーツ津環づゥツ陳シツ静シツづ1,b2ツづーツ津環づゥツ陳シツ静シツづ個古ーツ点ツ計ツ算
 P intersection_l(P a1, P a2, P b1, P b2)
 {
 	P a = a2 - a1; P b = b2 - b1;
 	return a1 + a * cross(b, b1-a1) / cross(b, a);
 }
 */

double cross(P a, P b)
{	return a.real() * b.imag() - b.real() * a.imag(); }
int main()
{
	int n;
	cin >> n;
	
	while(n--)
	{
		vector<P> p(3);
		
		rep(i, 3) cin >> p[i].real() >> p[i].imag();
		
		// ツ陳点ツづーツ出ツつキ
		P c1((p[0] + p[1]) / 2.0), c2((p[1] + p[2]) / 2.0);
		
		// ツ法ツ静シツベツクツトツδ仰づーツ出ツつキ
		P u1((p[0] - p[1]) * P(0, 1)), u2((p[1] - p[2]) * P(0, 1));
		
		// ツ古ーツ点ツづーツ出ツつキ
		P crs(c1 + u1 * cross(u2, (c2 - c1)) / cross(u2, u1));
		
		// ツ板シツ径ツづーツ出ツつキ
		double r = abs(crs - p[0]);
		
		printf("%.3f %.3f %.3f\n", crs.real(), crs.imag(), r);
	}
}

C++: #include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double inp,a,b,c,d,e,f,x,y,r;
	vector<double> xy;

	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
		{
			cin>>inp;
			xy.push_back(inp);
		}
		a=2*(xy[x2]-xy[x1]);
		b=2*(xy[y2]-xy[y1]);
		c=2*(xy[x3]-xy[x2]);
		d=2*(xy[y3]-xy[y2]);
		e=xy[y2]*xy[y2]-xy[y1]*xy[y1]+xy[x2]*xy[x2]-xy[x1]*xy[x1];
		f=xy[y3]*xy[y3]-xy[y2]*xy[y2]+xy[x3]*xy[x3]-xy[x2]*xy[x2];

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);
		r=sqrt(pow(xy[x1]-x,2)+pow(xy[y1]-y,2));

		x+=0.0005;
		y+=0.0005;
		r+=0.0005;

		printf("%.3lf %.3lf %.3lf",x,y,r);
	}
}

C++: #include<stdio.h>
#include<math.h>
int main(){
    int a;
    scanf("%d",&a);
    while(a--){
        double x1,y1,x2,y2,x3,y3;
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        double a1=2*(x2-x1);
        double b1=2*(y2-y1);
        double c1=x1*x1-x2*x2+y1*y1-y2*y2;
        double a2=2*(x3-x1);
        double b2=2*(y3-y1);
        double c2=x1*x1-x3*x3+y1*y1-y3*y3;
        double x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
        double y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
        double r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
}

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

int main(){
	int n;
	double x1,x2,x3,y1,y2,y3;
	double a1,a2,b1,b2,c1,c2;
	double px,py;

	cin >> n;
	while(n > 0){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	
	a1 = 2 * (x2 - x1);
	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);
	
	cout << fixed << setprecision(3) << px << " " << fixed << setprecision(3) << py << " " << fixed << setprecision(3) << hypot(px - x1, py - y1) << endl;
	n--;
	}

	return 0;
}