Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		circleTriangle()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func circleTriangle() {
	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 <iomanip>
#include <cmath>
using namespace std;

int main(){
	int n;
	cin >> n;
	double x[n], y[n], r[n];
	for(int i = 0; i < n; i++){
		double x1, y1, x2, y2, x3, y3;
		double a, b, c, d, e, f;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a = 2*(x1-x2);
		b = 2*(y1-y2);
		c = 2*(x2-x3);
		d = 2*(y2-y3);
		e = x1*x1-x2*x2+y1*y1-y2*y2;
		f = x2*x2-x3*x3+y2*y2-y3*y3;
		x[i] = (d*e-b*f)/(a*d-c*d);
		y[i] = (a*f-c*e)/(a*d-b*c);
		r[i] = sqrt((x[i]-x1)*(x[i]-x1)+(y[i]-y1)*(y[i]-y1));
		if((int)floor(r[i]*10000)%10 > 4){
			r[i] = r[i] + 0.001;
		}
	}
	for(int i = 0; i < n; i++){
		cout <<  fixed << setprecision(3) << x[i] << " " << y[i] << " " << r[i] << endl;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

#define EPS (1e-10)

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}

    Point operator + (const Point &p) const {
        return Point(x + p.x, y + p.y);
    }

    Point operator - (const Point &p) const {
        return Point(x - p.x, y - p.y);
    }
    
    Point operator * (const double &k) const {
        return Point(x * k, y * k);
    }
};

double dot(const Point &a, const Point &b)
{
    return a.x * b.x + a.y * b.y;
}

double norm(const Point &p)
{
    return dot(p, p);
} 

double abs(const Point &p)
{
    return sqrt(norm(p));
}

typedef vector<Point> Polygon;

struct Circle {
    Point p;
    double r;
    Circle(){}
    Circle(Point p, double r) : p(p), r(r) {}
};

Circle smallest_enclosing_circle(const Polygon &pg)
{    
    Point p(0, 0);
    for (int i = 0; i < (int)pg.size(); i++) {
	p = p + pg[i];
    }
    p = p * (1. / pg.size());
    double d = 0.5;
    for (int k = 1; k <= 30; k++) {
	for (int i = 0; i < 10; i++) {
	    int s = 0;
	    for (int j = 0; j < (int)pg.size(); j++) {
		if (abs(pg[j] - p) > abs(pg[s] - p)) {
		    s = j;
		}
	    }
	    p = p + (pg[s] - p) * d;
	}
	d *= 0.5;
    }
    double r = 0;
    for (int i = 0; i < (int)pg.size(); i++) {
	if (abs(pg[i] - p) > r) {
	    r = abs(pg[i]-p);
	}
    }
    return Circle(p, r);
}

double round(double x)
{
    x *= 1000;
    x = x + (x >= 0 ? 0.5 : -0.5);
    x = (int)x;
    return x / 1000;
}

int main()
{
    Polygon pg(3);
    int N;
    cin >> N;
    while (N--) {
        for (int i = 0; i < 3; i++) {
            cin >> pg[i].x >> pg[i].y;
        }
        auto c = smallest_enclosing_circle(pg);
        printf("%.3f %.3f %.3f\n", round(c.p.x), round(c.p.y), round(c.r));
    }
    return 0;
}

C++: #include<iostream>
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;

		double a1 = 2*(x2 - x1);
		double b1 = 2*(y2 - y1);
		double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;

		double a2 = 2*(x3 -x1);
		double b2 = 2*(y3 - y1);
		double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

		double x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		double y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);

		double r_2 = (x1 - x)*(x1 - x) + (y1 - y)*(y1 - y);
		double r = sqrt(r_2);

		cout << x << " " << y << " " << r << endl;
	}

	return 0;
}