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 <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


inline double inp(const P &a, const P &b) {
	return (conj(a) * b).real();
}

inline double outp(const P &a, const P &b) {
	return (conj(a) * b).imag();
}

P circumc(const P &a, const P &b, const P &c) {
	return (a + b - (inp(c - b, a - c) / outp(b - a, c - b)) * (b - a) * P(0, 1)) / 2.0;
}

double circumr(const P &A, const P &B, const P &C) {
	double a = abs(B - C), b = abs(A - C), c = abs(B - C);
	double s = (a + b + c) / 2.0;
	double S = sqrt(s * (s - a) * (s - b) * (s - c));
	return a * b * c / 4.0 / S;
}


int main(){
	int n; cin >> n;
	while (n--) {
		double x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		P p1(x1, y1), p2(x2, y2), p3(x3, y3);
		P c = circumc(p1, p2, p3);
		double r = circumr(p1, p2, p3);
		printf("%.3lf %.3lf %.3lf\n", c.real(), c.imag(), r);
	}
	return 0;
}

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

int main()
{
  double eps = 10e-7;
  double x1,y1,x2,y2,x3,y3;
  int T;
  scanf("%d",&T);
  for(int i=0;i<T;i++){
  scanf("%lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
  double a = pow(x2-x3,2.0)+pow(y2-y3,2.0);
  double b = pow(x3-x1,2.0)+pow(y3-y1,2.0);
  double c = pow(x1-x2,2.0)+pow(y1-y2,2.0);
  double a2 = sqrt(pow(x2-x3,2.0)+pow(y2-y3,2.0));
  double b2 = sqrt(pow(x3-x1,2.0)+pow(y3-y1,2.0));
  double c2 = sqrt(pow(x1-x2,2.0)+pow(y1-y2,2.0));
  double s = (a2+b2+c2)/2.0;
  double S = sqrt(s*(s-a2)*(s-b2)*(s-c2));
  double px = (a*(b+c-a) * x1 + b*(c+a-b) * x2 + c*(a+b-c) * x3) / (16.0*pow(S,2.0));
  double py = (a*(b+c-a) * y1 + b*(c+a-b) * y2 + c*(a+b-c) * y3) / (16.0*pow(S,2.0));
  double r = a2*b2*c2/(4.0*S);
  px += 0.0005 + eps;
  py += 0.0005 + eps;
  r += 0.0005 + eps;
  printf("%.3f %.3f %.3f\n",px,py,r);
  }
}

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

int main() {
    cout.precision(3);
    cout << fixed;
    int n;
    cin >> n;
    double x1, y1, x2, y2, x3, y3;
    while (n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        if (y1 == y2) swap(x1, x3), swap(y1, y3);
        if (y1 == y3) swap(x1, x2), swap(y1, y2);

        // y = a * x + b
        double mx1, my1, a, b;
        mx1 = (x1 + x2) / 2.0;
        my1 = (y1 + y2) / 2.0;
        a = -(x2 - x1) / (y2 - y1);
        b = my1 - a * mx1;

        // y = c * x + d
        double mx2, my2, c, d;
        mx2 = (x1 + x3) / 2.0;
        my2 = (y1 + y3) / 2.0;
        c = -(x3 - x1) / (y3 - y1);
        d = my2 - c * mx2;

        // intersection
        double cx, cy;
        cx = (d - b) / (a - c);
        cy = (a * d - b * c) / (a - c);

        cout << cx << " " << cy << " " << hypot(cx - x1, cy - y1) << endl;
    }
    return 0;
}

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

using namespace std;

double dist(double x1, double y1, double x2, double y2){
	return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}

int main(){

	double x[3], y[3];
	int n;

	cin >> n;
	while(n-- > 0){
		for(int i = 0; i < 3; i++){
			cin >> x[i] >> y[i];
		}

		double a = x[1] - x[0];
		double b = y[1] - y[0];
		double c = x[2] - x[1];
		double d = y[2] - y[1];
		double e = x[1]*x[1] - x[0]*x[0] + y[1]*y[1] - y[0]*y[0];
		double f = x[2]*x[2] - x[1]*x[1] + y[2]*y[2] - y[1]*y[1];

		double p = (e*d - f*b) / (2 * (a*d - b*c));
		double q = (e*c - f*a) / (2 * (b*c - a*d));

		double r = dist(x[0], y[0], p, q);

		cout.setf(ios::fixed);
		cout.precision(3);
		cout << p << ' ' << q << ' ' << r << endl;
	}

	return 0;
}

C++: 
#include<iostream>
#include<math.h>
#include<cstdio>
using namespace std;
int main(){
    double x1,y1,x2,y2,x3,y3;
    double a,b,c,x,y;
    double n,px,py,r;
    cin >> n;
    while(n--){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        
        a = sqrt(pow(x2-x1,2) + pow(y2-y1,2));
        b = sqrt(pow(x3-x2,2) + pow(y3-y2,2));
        c = sqrt(pow(x3-x1,2) + pow(y3-y1,2));
        
        x = ((a*a)-((b*b)+(c*c)))/(-2*b*c);
        y = sqrt(1-x*x);
        r = a/(2*y);
        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", px, py, r);
    }
}

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

int main() {
	int num;
	double x1,y1,x2,y2,x3,y3,px,py,r;
	cin>>num;
	while(num--){
		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));
		r=sqrt(pow((x1-px),2.0)+pow((y1-py),2.0));
		printf("%.3f %.3f %.3f\n",px,py,r);
	}	
	return 0;
}

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

double length(double x1, double y1, double x2, double y2) {
    return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}

double round(double d) {
    if (d < 0) {
        d *= 1000;
        d -= 0.5;
        int i = d;
        d = i / 1000.0;
    } else {
        d *= 1000;
        d += 0.5;
        int i = d;
        d = i / 1000.0;
    }

    return d;
}

int main() {

    int n;
    cin >> n;

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

        px = ((y1 - y3) * (pow(x1, 2) - pow(x2, 2) + pow(y1, 2) - pow(y2, 2)) - (y1 - y2) * (pow(x1, 2) - pow(x3, 2) + pow(y1, 2) - pow(y3, 2))) / ((x1 - x2) * (y1 - y3) - (x1 - x3) * (y1 - y2)) / 2.0;
        py = ((x1 - x3) * (pow(x1, 2) - pow(x2, 2) + pow(y1, 2) - pow(y2, 2)) - (x1 - x2) * (pow(x1, 2) - pow(x3, 2) + pow(y1, 2) - pow(y3, 2))) / ((x1 - x3) * (y1 - y2) - (x1 - x2) * (y1 - y3)) / 2.0;
        r = length(x1, y1, px, py);

        px = round(px);
        py = round(py);
        r = round(r);

        cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
    }

    return 0;
}