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 <cmath>
#include <cstdio>
#define MAX_N 20
using namespace std;

void swap(double &x,double &y){
	double t;
	t=x;
	x=y;
	y=t;
}

double cut4(double x){
	double temp=x*pow(10,3);
	temp=double(int(temp+0.5));
	return temp*pow(10,-3);
}

int main(){
	int n;
	double x1,x2,x3,y1,y2,y3,px[MAX_N],py[MAX_N];
	double a,b,c,d,r[MAX_N];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		if(x1==x2){
			swap(x2,x3);
			swap(y2,y3);
		}else if(x2==x3){
			swap(x1,x2);
			swap(y1,y2);
		}
		a=(y2-y1)/(x2-x1);
		c=(y3-y2)/(x3-x2);
		if(a&&c){
			a=-1/a;
			c=-1/c;
			b=(y1+y2)/2-a*(x1+x2)/2;
			d=(y2+y3)/2-c*(x2+x3)/2;
			px[i]=(b-d)/(c-a);
			py[i]=(b*c-a*d)/(c-a);
		}else if(!a){
			c=-1/c;
			d=(y2+y3)/2-c*(x2+x3)/2;
			px[i]=(x1+x2)/2;
			py[i]=c*(x1+x2)/2+d;
		}else if(!c){
			a=-1/a;
			b=(y1+y2)/2-a*(x1+x2)/2;
			px[i]=(x2+x3)/2;
			py[i]=a*(x2+x3)/2+b;
		}

		r[i]=sqrt((px[i]-x1)*(px[i]-x1)+(py[i]-y1)*(py[i]-y1));	
	}
	for(int i=0;i<n;i++) printf("%.3lf %.3lf %.3lf\n",cut4(px[i]),cut4(py[i]),cut4(r[i])); 
	return 0;
}

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

int main() {
	int n;
	cin>>n;
	for(int h=0;h<n;h++){
double x1,y1,x2,y2,x3,y3,x2m,x3m,y2m,y3m,x21,y21,x31,y31,xy21,xans,yans;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
	x2m=(x1+x2)/2;
	y2m=(y1+y2)/2;
	x3m=(x1+x3)/2;
	y3m=(y1+y3)/2;
	x21=x2-x1;
	x31=x3-x1;
	y21=y2-y1;
	y31=y3-y1;
	
	
if(y1!=y2){
	xy21=x21/y21;
	xans=(x31*x3m+y31*xy21*x2m+y3m-y2m)/(x31+y31*xy21);
	yans=xy21*(xans-x2m)+y2m;
}	
else{
	xans=x2m;
	yans=(x3m-xans)*x31/y31+y3m;
}
double r;
r=sqrt((xans-x1)*(xans-x1)+(yans-y1)*(yans-y1));
double x=xans,y=yans;
	printf("%.3f %.3f %.3f\n",xans,yans,r);
}

	return 0;
}

C++: /* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */
/* include {{{ */
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
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-12;
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;
  cin >> n;

  while (n--){
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

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

    double y = (c * (sq(x1) * sq(y1) - sq(x2) - sq(y2)) - a * (sq(x1) + sq(y1) - sq(x3) - sq(y3))) / (c * b == a * d ? EPS : c * b - a * d);
    double x = (sq(x1) + sq(y1) - sq(x3) - sq(y3) - d * y) / (c == 0 ? EPS : c);
    double r = sqrt(sq(x - x1) + sq(y - y1));
    printf("%.3f %.3f %.3f\n", x, y, r);
  }

  return (0);
}

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

int main(void) {
  int i, n, j, k;
  double x1, y1, x2, y2, x3, y3;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
    double xt1 = (x1 + x2) / 2, xt2 = (x3 + x2) / 2, yt1 = (y1 + y2) / 2, yt2 = (y3 + y2) / 2;
    double t1 = y1 - y2, t2 = y2 - y3;
    double x, y, k1, k2;
    if(!t1) {
      x = xt1;
      k2 = -(x2 - x3) / (y2 - y3);
      y = k2 * (x - xt2) + yt2;
    } else if(!t2) {
      x = xt2;
      k1 = -(x1 - x2) / (y1 - y2);
      y = k1 * (x - xt1) + yt1;
    } else {
      k1 = -(x1 - x2) / (y1 - y2), k2 = -(x2 - x3) / (y2 - y3);
      x = ((k1 * xt1 - k2 * xt2) - (yt1 - yt2)) / (k1 - k2);
      y = k1 * (x - xt1) + yt1;
      //printf("%f %f ", k1, k2);
    }
    double r = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
    //printf("%f %f %f %f\n", xt1, yt1, xt2, yt2);
    printf("%.3f %.3f %.3f\n", x, y, r);
  }
  return 0;
}