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++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
struct {double x, y;} p[3], q[2], o;
int main()
{
	int n, i, j;
	double r, m[2], a, b, c, d;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < 3; j++)
			cin >> p[j].x >> p[j].y;

		q[0].x = (p[0].x + p[1].x) / 2;
		q[0].y = (p[0].y + p[1].y) / 2;
		q[1].x = (p[0].x + p[2].x) / 2;
		q[1].y = (p[0].y + p[2].y) / 2;
		m[0] = ((p[0].x == p[1].x) ? 0 : (p[1].y-p[0].y)/(p[1].x-p[0].x));
		m[1] = ((p[0].x == p[2].x) ? 0 : (p[2].y-p[0].y)/(p[2].x-p[0].x));

		if (p[0].x == p[1].x)
		{
			c = -1/m[1];
			d = q[1].x/m[1]+q[1].y;
			o.y = q[0].y;
			o.x = (d-o.y)/c;
		}
		else if (p[0].y == p[1].y)
		{
			c = -1/m[1];
			d = q[1].x/m[1]+q[1].y;
			o.x = q[0].x;
			o.y = c * o.x + d;
		}
		else if (p[0].x == p[2].x)
		{
			a = -1/m[0];
			b = q[0].x/m[0]+q[0].y;
			o.y = q[1].y;
			o.x = (b-q[1].y)/a;
		}
		else if (p[0].y == p[2].y)
		{
			a = -1/m[0];
			b = q[0].x/m[0]+q[0].y;
			o.x = q[1].x;
			o.y = a * o.x + b;
		}
		else
		{
			a = -1/m[0];
			b = q[0].x/m[0]+q[0].y;
			c = -1/m[1];
			d = q[1].x/m[1]+q[1].y;
			o.x = (d-b)/(a-c);
			o.y = a*o.x+b;
		}
		r = sqrt((p[0].x-o.x)*(p[0].x-o.x)+(p[0].y-o.y)*(p[0].y-o.y));
		cout << setprecision(3) << setiosflags(ios::fixed);
		cout << o.x << " " << o.y << " " << r << endl;
	}
}

C++: /* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool is_uruu(int y) {return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;}
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}

/* }}} */

#define sq(x) ((x) * (x))

signed main()
{
  //cin.tie(0);
  //ios::sync_with_stdio(false);

  int n;
  scanf("%d", &n);

  while (n--){
    double x1, y1, x2, y2, x3, y3;
    scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);

    double a = 2 * (x1 - x2), b = 2 * (y1 - y2),
           c = 2 * (x1 - x3), d = 2 * (y1 - y3);
    double e = sq(x1) + sq(y1) - sq(x2) - sq(y2),
           f = sq(x1) + sq(y1) - sq(x3) - sq(y3);

    double x = (1 / (a * d - b * c)) * (d * e - b * f),
           y = (1 / (a * d - b * c)) * (-c * e + a * f);

    double r = sqrt(sq(x - x1) + sq(y - y1));
    printf("%.3f %.3f %.3f\n", x, y, r);
  }

  return 0;
}

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

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3;

	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		if(y1-y2==0.0 && y1-y2==0.0){
			swap(x1, x2);
			swap(y1, y2);
		}
		if(y1-y2==0.0 && y1-y2==0.0){
			swap(x1, x3);
			swap(y1, y3);
		}

		double a12, b12, a13, b13;
		a12 = -(x1-x2)/(y1-y2);
		a13 = -(x1-x3)/(y1-y3);

		double x12, y12, x13, y13;
		x12 = (x1+x2)/2.0;
		y12 = (y1+y2)/2.0;
		x13 = (x1+x3)/2.0;
		y13 = (y1+y3)/2.0;

		b12 = y12 - a12 * x12;
		b13 = y13 - a13 * x13;

		double xp, yp;
		xp = -(b12-b13)/(a12-a13);
		yp = a12*xp + b12;

		double r;
		r = sqrt(pow((x1-xp),2.0) + pow((y1-yp),2.0));

		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}


	return(0);
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>

using namespace std;

typedef long long int lli;

int main() {
	int n;
	double xy[3][3],x,y;
	double a, b, c, d, e, f, radius;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 2; k++) {
				cin >> xy[j][k];
			}
		}
		a = -2 * (xy[0][0]-xy[1][0]);
		b = -2 * (xy[0][1] - xy[1][1]);
		c = -1 * (pow(xy[0][0], 2) + pow(xy[0][1], 2)) + pow(xy[1][0], 2) + pow(xy[1][1], 2);
		d = -2 * (xy[0][0] - xy[2][0]);
		e = -2 * (xy[0][1] - xy[2][1]);
		f = -1 * (pow(xy[0][0], 2) + pow(xy[0][1], 2)) + pow(xy[2][0], 2) + pow(xy[2][1], 2);
		y = (a*f - c*d) / (a*e - b*d);
		x = (c*e - b*f) / (a*e - b*d);
		if (x == 0) x = 0;
		if (y == 0) y = 0;
		radius =sqrt((x-xy[0][0])+(y-xy[0][1]));

		cout << fixed << setprecision(3) << x << " " << y << " "<< radius <<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <complex>

using namespace std;

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); }

P ssCrosspoint(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);
}

int main(){
	int n; cin >> n;
	while(n--){
		P p[3];
		for(int i=0;i<3;i++) cin >> real(p[i]) >> imag(p[i]);
		P m0 = 0.5*(p[0]+p[1]);
		P m1 = 0.5*(p[0]+p[2]);
		P c = ssCrosspoint(L(m0, m0+(p[1]-p[0])*P(0,1)), L(m1, m1+(p[2]-p[0])*P(0,1)));
		printf("%.3lf %.3lf %.3lf\n", real(c), imag(c), abs(c-p[0]));
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>

using namespace std;

double hankei(double z1,double z2,double dx,double dy){
	 
	double r = sqrt((dx - z1)*(dx - z1) + (dy - z2)*(dy - z2));
	return r;
}


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

		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));

		printf("%.3f %.3f %.3f \n",floor(px * 1000 + 0.5) / 1000,floor(py * 1000 + 0.5) / 1000 ,floor(hankei(x1, y1, px, py) * 1000 + 0.5) / 1000);
	}
	
	return 0;
}