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 <iostream>
#include <cstdio>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> Point;

bool eqv(double d1, double d2) {
    return abs(d1-d2) < 1e-5;
}

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

    while(true) {
        cin >> N;
        if(!N) break;

        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        Point p1(x1, y1), p2(x2, y2), p3(x3, y3);

        double R = abs(abs(p3-p2) / sin(arg(p2-p1) - arg(p3-p1))) / 2;
        Point pc = (p1+p2) / 2.;
        Point ph1 = (pc-p1) * Point(0, 1);
        double L = sqrt(R*R - norm(pc-p1));
        Point center = pc + ph1 * L / abs(ph1);
        if(!eqv(abs(center-p1), abs(center-p2)) ||
           !eqv(abs(center-p1), abs(center-p3)) ||
           !eqv(abs(center-p3), abs(center-p2))) center = pc - ph1*L/abs(ph1);


        printf("%.3f %.3f %.3f\n", center.real(), center.imag(), R);
    }
    return 0;
}