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 <cmath>

using namespace std;

void Circle()
{
    double x1, y1;
    double x2, y2;
    double x3, y3;
    double px, py, r;
    int n;
    
    cin>>n;
    
    while(n--)
    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        
        //AB: (y - y1) / (y2 - y1) = (x - x1) / (x2 - x1);
        //BC:  (y - y2) / (y3 - y2) = (x - x2) / (x3 - x2);
        px = ((y1 - y3) * (y1 * y1 - y2 * y2 + x1 * x1 - x2 * x2) - (y1 - y2) * (y1 * y1 - y3 * y3 + x1 * x1 - x3 * x3)) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3));
        
        py = ((x1 - x3) * (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2) - (x1 - x2) * (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3)) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3));
        
        r = sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py));
        
        cout.setf(ios::fixed);
        cout.precision(3);
        
        cout<<px<<" "<<py<<" "<<r<<endl;
    }
    
    return;
}

int main()
{
    Circle();
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/




int main()
{
	int a;
	
	scanf("%d", &a);
	
	for (; a>0; a--)
	{
		double a1, a2, b1, b2, c1, c2, x1, y1, x2, y2, x3, y3;
		double x, y, r;
		
		scanf("%lf%lf%lf%lf%lf%lf", &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;
		x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
		r = hypot(x - x1, y - y1);
		printf("%.3lf %.3lf %.3lf\n", x, y, r);
	}
	
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

double add_double(double a,double b){
	if(abs(a+b)<eps*(abs(a)+abs(b))) return 0;
	return a+b;
}

struct point{
	double x,y;
	point operator+(point p){
		return point{add_double(x,p.x),add_double(y,p.y)};
	}
	point operator-(point p){
		return point{add_double(x,-p.x),add_double(y,-p.y)};
	}
	point operator*(double p){
		return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(add_double(x,-p.x))<eps&&fabs(add_double(y,-p.y))<eps;
	}
	bool operator<(point p){
		if(fabs(x-p.x)>eps) return x<p.x;
		return y<p.y;
	}
};

typedef pair<point,point> pp;
typedef vector<point> VP;
const point O{0,0};

int n;
VP Tri(3);

class Geom{
	public:
	double Length(point x,point y){
		point z=y-x;
		return sqrt(z.x*z.x+z.y*z.y);
	}
	double IP(point p,point q){
		return p.x*q.x+p.y*q.y;
	}
	double CP(point p,point q){
		return p.x*q.y-q.x*p.y;
	}
	point Inter(pp  a,double x,double y){
		return (a.first*y+a.second*x)/(x+y);
	}
	point Exterior(pp a,double x,double y){
		return (a.first*-y+a.second*x)/(x-y);
	}
	point Normal(point p){
		return point{p.y,-p.x};
	}
	string Counter_Clockwise(pp a,point x){
		point A=a.second-a.first;
		point X=x-a.first;
		double ip=IP(A,X),cp=CP(A,X),Al=Length(O,A),Xl=Length(O,X);
		if(cp>eps) return "Counter_Clockwise";
		if(cp<-eps) return "Clockwise";
		if(ip<-eps) return "Online_Back";
		if(Xl<Al||fabs(Xl-Al)<eps) return "On_Segment";
		return "Online_Front";
	}
	point Projection(pp a,point x){
		point A=x-a.first,B=a.second-a.first;
		double l=Length(O,B);
		return B*IP(A,B)/(l*l)+a.first;
	}
	point Cross_Point(pp a,pp b){
		point p=Projection(a,b.first),q=Projection(a,b.second);
		double pl=Length(b.first,p),ql=Length(b.second,q);
		string S=Counter_Clockwise(a,b.first),T=Counter_Clockwise(a,b.second);
		if(S==T) return Exterior(b,pl,ql);
		else return Inter(b,pl,ql);
	}
	void Point_in(point& p){
		cin>>p.x>>p.y;
	}
	point solve(VP p){
		point a=Inter(pp(p[0],p[1]),1,1),b=Inter(pp(p[1],p[2]),1,1),c=p[1]-p[0],d=p[2]-p[1];
		return Cross_Point(pp(a,a+Normal(c)),pp(b,b+Normal(d)));
	}
};

double Rounding(double x,int y){
	double tmp=pow(10,y);
	x/=tmp;
	x+=0.5;
	x=(int)x;
	x*=tmp;
	return x;
}

int main(){
	cout<<syosu(3);
	Geom geo;
	cin>>n;
	for(int i=0;i<n;i++){
		for(VP::iterator i=Tri.begin();i!=Tri.end();i++) geo.Point_in(*i);
		point t=geo.solve(Tri);
		cout<<Rounding(t.x,-3)<<' '<<Rounding(t.y,-3)<<' '<<Rounding(geo.Length(Tri[0],t),-3)<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x1_2,x1_3,y1_2,y1_3,z1_2,z1_3,a,b,c,r;
	while(cin >> n){
		for(int i = 0;i < n;++i){
			cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
			z1_2 = (((x1 * x1) + (y1 * y1)) * -1) - (((x2 * x2) + (y2 * y2)) * -1);
			z1_3 = (((x1 * x1) + (y1 * y1)) * -1) - (((x3 * x3) + (y3 * y3)) * -1);
			x1_2 = x1 - x2;
			x1_3 = x1 - x3;
			y1_2 = y1 - y2;
			y1_3 = y1 - y3;
			a = ((y1_2 * z1_3) - (y1_3 * z1_2)) / ((y1_2 * x1_3) - (y1_3 * x1_2)) * -1;
			b = ((x1_2 * z1_3) - (x1_3 * z1_2)) / ((x1_2 * y1_3) - (x1_3 * y1_2)) * -1;
			c = ((x1 * x1) + (y1 * y1) + (a * x1) + (b * y1)) * -1;
			r = sqrt(c + (a * a / 4) + (b * b / 4));
			printf("%.3f %.3f %.3f",a / 2,b / 2,r);
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
	int k;
	double x[3], y[3], a, b, c, d, e, f, l , m, n;
	cin >> k;
	while(k--){
		cin>> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
		a = 2 * (x[1] - x[0]);
		b = 2 * (y[1] - y[0]);
		c = ( (x[1]*x[1]) + (y[1]*y[1]) ) -( (x[0]*x[0]) + (y[0]*y[0]) );
		d = 2 * (x[2] - x[0]);
		e = 2 * (y[2] - y[0]);
		f = ( (x[2]*x[2]) + (y[2]*y[2]) ) -( (x[0]*x[0]) + (y[0]*y[0]) );
		l = (c*e - f*b) / (a*e - d*b);
		m = (c*d - f*a) / (b*d - e*a);
		n = sqrt((l - x[0])*(l - x[0]) + (m - y[0])*(m - y[0]));
		cout << fixed << setprecision(3) << l << " " << m << " " << n << endl;
	}
}