Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

C++: /*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////
template <class T>
void printMartix(valarray<valarray<T> > &A)
{
  int n = A.size();
  int m = A[0].size();
  REP(i,n){{REP(j,n) cout << A[i][j] << " ";} cout << endl;}
  cout << endl;
}

template <class T>
void printArray(valarray<T> &A)
{
  int n = A.size();
  REP(i,n) cout << A[i] << " ";
  cout << endl << endl;
}

template <class T>
bool solution(valarray<valarray<T> > &A, valarray<T> &b)
{
  int n = A.size();
  REP(i,n)
  {
    T a;
    //printMartix(A);
    //printArray(b);
    REP2(u,i,n)
    {
      a = A[u][i];
      if(a == 0) continue;
      else
      {
        if(u != i)
        {
          swap(A[i],A[u]);
          swap(b[i],b[u]);
        }
        break;
      }
      if(u == n-1) return false;
    }
    A[i] /= (1.0 * a);
    b[i] /= (1.0 * a);
    REP(j,n)
    {
      if(j == i) continue;
      b[j] -= b[i] * A[j][i];
      A[j] -= A[i] * A[j][i];
    }
    //printMartix(A);
    //printArray(b);
  }
  return true;
}

/////
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int n; cin >> n;
  REP(u,n)
  {
    double x[3], y[3]; REP(i,3) cin >> x[i] >> y[i];
    valarray<valarray<double> > A(valarray<double>(0.0,3),3);
    valarray<double> b(0.0,3);
    REP(i,3)
    {
      A[i][0] = x[i];
      A[i][1] = y[i];
      A[i][2] = 1;
      b[i] = -(x[i]*x[i] + y[i]*y[i]);
    }
    solution(A,b);
    double cx = -b[0] * 0.5;
    double cy = -b[1] * 0.5;
    double r = sqrt((x[0]-cx)*(x[0]-cx)+(y[0]-cy)*(y[0]-cy));
    printf("%.3lf %.3lf %.3lf\n",cx,cy,r);
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
#define sqr(x) ((x) * (x))
using namespace std;

void equation(double a, double b, double c, double d, double e, double f, double *x, double *y)
{
  *x = (c * e - b * f) / (a * e - b * d);
  *y = (a * f - c * d) / (a * e - b * d);   
}


int main()
{
  int n;
  double x1, y1, x2, y2, x3, y3, x, y;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    x = y = 0;
    equation((2 * (x2 - x1)), (2 * (y2 - y1)), (sqr(x2) + sqr(y2) - sqr(x1) - sqr(y1)), (2 * (x3 - x2)), (2 * (y3 - y2)), (sqr(x3) + sqr(y3) - sqr(x2) - sqr(y2)), &x, &y);
    cout << fixed << setprecision(3) << x << ' ' << y << ' ' << sqrt(sqr(x1 - x) + sqr(y1 - y)) << endl;
  }
}

C++: #include<cstdio>
#include<cmath>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		double a[6],matrix[4],ans[2];
		scanf("%lf %lf %lf %lf %lf %lf",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]);
		matrix[0] = 2*(a[0]-a[2]);
		matrix[1] = 2*(a[1]-a[3]);
		matrix[2] = 2*(a[0]-a[4]);
		matrix[3] = 2*(a[1]-a[5]);
		ans[0] = a[0]*a[0]+a[1]*a[1]-a[2]*a[2]-a[3]*a[3];
		ans[1] = a[0]*a[0]+a[1]*a[1]-a[4]*a[4]-a[5]*a[5];
		double t = matrix[0]*matrix[3]-matrix[1]*matrix[2];
		double x = matrix[3]*ans[0]/t-matrix[1]*ans[1]/t;
		double y = matrix[0]*ans[1]/t-matrix[2]*ans[0]/t;
		printf("%.3lf %.3lf %.3lf\n",x,y,sqrt((a[0]-x)*(a[0]-x)+(a[1]-y)*(a[1]-y)));
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
typedef vector <double> vd;
typedef vector <vd> vvd;

int equation(vvd &A){
    int n1=3;
	for (int i1=0; i1<n1; i1++){
		int j1=i1;
		if (A[j1][i1]==0)
			for (int j2=j1+1; j2<n1; j2++)
				if (A[j2][i1]!=0){
					for (int i3=0; i3<n1+1; i3++)
						swap(A[j2][i3], A[j1][i3]);
					break;
				}
		double tmp = A[j1][i1];
		for (int i2=0; i2<n1+1; i2++)
			A[j1][i2]/=tmp;

		for (int j2=0; j2<n1; j2++){
			if (j2==j1) continue;
			tmp = A[j2][i1];
			for (int i2=0; i2<n1+1; i2++)
				A[j2][i2] -= tmp * A[j1][i2];
		}
	}

    return 0;
}

int main(void){
    int n=0;
	double x=0, y=0, x0=0, y0=0, r=0;
	vvd A(3, vd(4));

	cin>>n;
	for (int i=0; i<n; i++){
		for (int j=0; j<3; j++){
			cin>>x>>y;
			A[j][0] = x;
			A[j][1] = y;
			A[j][2] = 1;
			A[j][3] = -(x*x + y*y);
		}
		equation(A);

		x0 = -A[0][3] / 2;
		y0 = -A[1][3] / 2;
		r = sqrt(pow(x-x0, 2) + pow(y-y0, 2));

		cout<<fixed<<setprecision(3);
		cout<<x0<<" "<<y0<<" "<<r<<endl;
	}
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
long n,i;
double x1,y1,x2,y2,x3,y3,Px,Py,r,a1,b1,c1,a2,b2,c2;
cin>>n;
for(i=0;i<n;i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
a1=(x2-x1)*2;
b1=(y2-y1)*2;
c1=x1*x1-x2*x2+y1*y1-y2*y2;
a2=(x3-x1)*2;
b2=(y3-y1)*2;
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-x)*(x1-x)+(y1-y)*(y1-y));
printf("%.3f %.3f %.3f\n",Px,Py,r);
}
return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <complex>
#include <iomanip>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
typedef vector<P> VP;
const D EPS = 1e-9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

D cross(P a, P b) {		// (2)
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) { // (16)
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;
  return a1 + d1/d2*(a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main() {
  P a1, a2, a3;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a1 = P(x1, y1);
    a2 = P(x2, y2);
    a3 = P(x3, y3);
    P ans = circumcenter(a1, a2, a3);
    std::cout << fixed << setprecision(3) << ans.X << " " << ans.Y << " " << abs(ans-a1) << std::endl;
  }

}