Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		cal()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func cal() {
	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 <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;

int main()
{
	double x1,y1,x2,y2,x3,y3;
	scanf("%d",&N);
	FOR(i,0,N){
		scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
		double a = pow(x1 - x2,2.0) + pow(y1 - y2,2.0);
		double b = pow(x2 - x3,2.0) + pow(y2 - y3,2.0);
		double c = pow(x3 - x1,2.0) + pow(y3 - y1,2.0);
		double s = a * (b + c - a) + b * (c + a - b) + c * (a + b - c);
		double x = (a * (b + c - a) * x3 + b * (c + a - b) * x1 + c * (a + b - c) * x2) / s;
		double y = (a * (b + c - a) * y3 + b * (c + a - b) * y1 + c * (a + b - c) * y2) / s;
		printf("%.3f %.3f %.3f\n",x,y,sqrt(pow(x - x1,2.0) + pow(y - y1,2.0)));
	}

	return 0;
}

C++: #include <bits/stdc++.h>

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;
const static int	de_MIN = -999999999;

inline double RoundOff(double a, const int n) {

	for (int i = 0; i < n - 1; i++) { a *= 10; }

	if (a > 0) { a += 0.5; }
	else { a -= 0.5; }

	a = static_cast<int>(a);

	for (int i = 0; i < n - 1; i++) { a /= 10; }

	return a;
}

inline double circumradius(std::complex<double> a, std::complex<double> b, std::complex<double> c) {

	//???
	double eAB = abs(b - a);
	double eBC = abs(c - b);
	double eCA = abs(a - c);

	//?§????(????????????)
	double aCAB = acos((eCA*eCA + eAB*eAB - eBC*eBC) / (2 * eCA*eAB));

	//?????\????????????(??£?????????)
	double R = 0.5*eBC / sin(aCAB);

	return(R);

}

inline std::complex<double> Circumcenter(std::complex<double> a, std::complex<double> b, std::complex<double> c) {

	//???
	double eAB = abs(b - a);
	double eBC = abs(c - b);
	double eCA = abs(a - c);

	//?§????(????????????)
	double aCAB = acos((eCA*eCA + eAB*eAB - eBC*eBC) / (2 * eCA*eAB));
	double aABC = acos((eAB*eAB + eBC*eBC - eCA*eCA) / (2 * eAB*eBC));
	double aBCA = acos((eBC*eBC + eCA*eCA - eAB*eAB) / (2 * eBC*eCA));

	double A = sin(2 * aCAB);
	double B = sin(2 * aABC);
	double C = sin(2 * aBCA);

	//???????????????????????????(?????????????????¢???????????¬???)
	std::complex<double> ans;
	ans.real((A*a.real() + B*b.real() + C*c.real()) / (A + B + C));
	ans.imag((A*a.imag() + B*b.imag() + C*c.imag()) / (A + B + C));

	return(ans);
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	int n = 0;
	std::cin >> n;
	double x1 = 0, y1 = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0;

	std::complex<double> a, b, c, ans;
	double r = 0;
	for (int i = 0; i < n; i++) {
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a.real(x1);	a.imag(y1);
		b.real(x2);	b.imag(y2);
		c.real(x3);	c.imag(y3);
		ans = Circumcenter(a, b, c);
		r = circumradius(a, b, c);
		std::cout << std::fixed << std::setprecision(3) << RoundOff(ans.real(), 4);
		std::cout << " ";
		std::cout << std::fixed << std::setprecision(3) << RoundOff(ans.imag(), 4);
		std::cout << " ";
		std::cout << std::fixed << std::setprecision(3) << RoundOff(r, 4) << std::endl;
	}



}

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

typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define dbg(x) cout << #x"="<< (x) << endl
#define fi first
#define se second
#define square(x) (x)*(x)

int main(){
	int n;
	cin >> n;
	vector<pair<double,double> > x(3);
	vector<double> d(3),r(3);
	pair<double,double> ans;
	double R;
	rep(j,n){
		rep(i,3){
			cin >> x[i].fi >> x[i].se;
		}
		d[0] = square(x[2].fi-x[1].fi) + square(x[2].se-x[1].se);
		d[1] = square(x[2].fi-x[0].fi) + square(x[2].se-x[0].se);
		d[2] = square(x[0].fi-x[1].fi) + square(x[0].se-x[1].se);
		r[0] = d[0]*(d[1]+d[2]-d[0]);
		r[1] = d[1]*(d[2]+d[0]-d[1]);
		r[2] = d[2]*(d[0]+d[1]-d[2]);
		R = r[0]+r[1]+r[2];
		ans.fi = (r[0]*x[0].fi+r[1]*x[1].fi+r[2]*x[2].fi)/R;
		ans.se = (r[0]*x[0].se+r[1]*x[1].se+r[2]*x[2].se)/R;
		R = square(x[0].fi-ans.fi) + square(x[0].se-ans.se);
		printf("%.3f %.3f %.3f\n",ans.fi,ans.se, sqrt(R));
	}
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>
  
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
  
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;
  
double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;
  
    ret = cross(p1,p2)/2.0;
      
    return abs(ret);
}
  
int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
          
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        printf("%.3lf %.3lf %.3lf\n",X,Y,R);
  
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;
int main() {
int s;
double a,b,c,d,e,f,g,h,i,j,m,n,x,y,r;
cin >> s;
for (s;s>0;s--) {
cin >> a >> b >> c >> d >> e >> f ;
if (b-d == 0) b=d+0.0000001;
if (f-d == 0) f=d+0.0000001;
m=(a-c)/(b-d); n=(e-c)/(f-d);
g=(a+c)/2; h=(b+d)/2;
i=(e+c)/2; j=(d+f)/2;
x=(j+n*i-h-m*g)/(n-m);
y=h-m*(x-g);
r=sqrt((x-a)*(x-a)+(y-b)*(y-b));
printf("%.3f %.3f %.3f\n",x,y,r);
}
return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>

struct Zahyou
{
	float x, y;
};

int main()
{
	int n;
	Zahyou de[4];

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		for (int j = 1; j < 4; j++)
		{
			scanf("%f %f", &de[j].x, &de[j].y);
		}
		de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) + (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) + 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x));
		de[0].y = ((de[1].x - de[3].x)*(pow(de[1].x, 2) - pow(de[2].x, 2) + pow(de[1].y, 2) - pow(de[2].y, 2)) + (de[1].x - de[2].y)*(pow(de[1].x, 2) - pow(de[3].x, 2) + pow(de[1].y, 2) - pow(de[3].y, 2))) / (2 * (de[1].x - de[3].x)*(de[1].y - de[2].y) + 2 * (de[1].x - de[2].x)*(de[1].y - de[3].y));
		
		printf("%.3f %.3f %.3f\n",de[0].x,de[0].y,sqrt((de[0].x-de[1].x)+(de[0].y-de[1].y)));
	}
	return 0;
}