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 <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
// ------ Classes ------ //
class Point {
public:
	long double px, py;
	Point() : px(0), py(0) {};
	Point(long double px_, long double py_) : px(px_), py(py_) {};
	bool operator==(const Point& p) const { return px == p.px && py == p.py; }
	bool operator!=(const Point& p) const { return px != p.px || py != p.py; }
	bool operator<(const Point& p) const { return px < p.px ? true : (px == p.px && py < p.py); }
	bool operator>(const Point& p) const { return px > p.px ? true : (px == p.px && py > p.py); }
	bool operator<=(const Point& p) const { return !(Point(px, py) > p); }
	bool operator>=(const Point& p) const { return !(Point(px, py) < p); }
	Point operator+(const Point& p) const { return Point(px + p.px, py + p.py); }
	Point operator-(const Point& p) const { return Point(px - p.px, py - p.py); }
	Point operator/(long double d) const { return Point(px / d, py / d); }
	friend Point operator*(const Point p, long double d) { return Point(p.px * d, p.py * d); }
	friend Point operator*(long double d, const Point& p) { return p * d; }
	Point& operator+=(const Point& p1) { px += p1.px, py += p1.py; return *this; }
	Point& operator-=(const Point& p1) { px -= p1.px, py -= p1.py; return *this; }
	Point& operator*=(long double d) { px *= d, py *= d; return *this; }
	Point& operator/=(long double d) { px /= d, py /= d; return *this; }
};
class Circle {
public:
	Point p; long double r;
	Circle() : p(Point()), r(0.0L) {};
	Circle(Point p_) : p(p_), r(0.0L) {};
	Circle(Point p_, long double r_) : p(p_), r(r_) {};
	Circle(long double x_, long double y_) : p(Point(x_, y_)), r(0.0L) {};
	Circle(long double x_, long double y_, long double r_) : p(Point(x_, y_)), r(r_) {};
	bool operator==(const Circle& c) const { return p == c.p && r == c.r; }
	bool operator!=(const Circle& c) const { return !(Circle(p, r) == c); }
};
// ------ Functions ------ //
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
long double arg(const Point& a) { return atan2l(a.py, a.px); }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
long double dst(const Point& a, const Point& b) { return abs(b - a); }
Point pol(long double r, long double d) { return Point(cosl(d) * r, sinl(d) * r); }
vector<Point> crp(Circle c1, Circle c2) {
	double d = abs(c1.p - c2.p);
	double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
	double t = arg(c2.p - c1.p);
	return{ c1.p + pol(c1.r, t + a), c1.p + pol(c1.r, t - a) };
}
// ------ Main ------ //
int n; Point p1, p2, p3;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p1.px >> p1.py >> p2.px >> p2.py >> p3.px >> p3.py;
		long double d1 = dst(p1, p2), d2 = dst(p2, p3), d3 = dst(p3, p1);
		long double r = d1 * d2 * d3 / sqrtl((d1 + d2 + d3) * (d1 + d2 - d3) * (d2 + d3 - d1) * (d3 + d1 - d2));
		vector<Point> v = crp(Circle(p1, r), Circle(p2, r));
		for (int j = 0; j < v.size(); j++) {
			long double d4 = dst(v[j], p3);
			if (d4 - 1e-10 <= r && r <= d4 + 1e-10) {
				int lx = (v[j].px + 0.00050001L) * 1000;
				int ly = (v[j].py + 0.00050001L) * 1000;
				printf("%.3Lf %.3Lf %.3Lf\n", lx / 1000.0L, ly / 1000.0L, r); break;
			}
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
#include<cmath>
using namespace std;

#define PI 3.1415926535898

//?????§?¨?????????¨??????
typedef complex<double> P;


//?¨±?????????
#define EPS (1e-10)
//X Y??§?¨?
#define X real()
#define Y imag()

class Triangle {
    private:
    //????§???¢???3????????§?¨?
    P a,b,c;
    //????§???¢???????????????
    double edgeA, edgeB, edgeC;
    //????§???¢????§??????§??????
    double angleA, angleB, angleC;
    //??????????????????3???????§????????±???????
    double LawOfCosines(double a, double b, double c) {
        return acos((b*b+c*c-a*a)/(2.0*b*c));
    }
    //2??????double??????????????????
    bool equal(double a,double b) {
        return (abs(a-b)<EPS)?true:false;
    }

    public:
    //?????????????????????
    Triangle(P p1, P p2, P p3) {
        a=p1;
        b=p2;
        c=p3;
        edgeB=abs(c-a);
        edgeA=abs(b-c);
        edgeC=abs(a-b);
        angleA=LawOfCosines(edgeA, edgeB, edgeC);
        angleB=LawOfCosines(edgeB, edgeC, edgeA);
        angleC=LawOfCosines(edgeC, edgeA, edgeB);
    }

    double circumscribedCircleRadius() {//?????\????????????
        return (edgeA/sin(angleA)/2.0);
    }

    double circumscribedCircleX() {//?????\????????????X??§?¨?
        double A=sin(2.0*angleA);
        double B=sin(2.0*angleB);
        double C=sin(2.0*angleC);
        return ((a.X * A + b.X * B + c.X * C)/(A+B+C));
    }

    double circumscribedCircleY() {//?????\????????????Y??§?¨?
        double A=sin(2.0*angleA);
        double B=sin(2.0*angleB);
        double C=sin(2.0*angleC);
        return ((a.Y * A + b.Y * B + c.Y * C)/(A+B+C));
    }
};


int main(){
    int mod=1000000007;
    int n;
    double x1,y1,x2,y2,x3,y3;
    double r,xp,yp;
    scanf("%d",&n);
    for (int i=0;i<n;i++) {
        scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
        P a(x1,y1);
        P b(x2,y2);
        P c(x3,y3);
        Triangle Tr(a,b,c);
        xp=Tr.circumscribedCircleX();
        yp=Tr.circumscribedCircleY();
        r =Tr.circumscribedCircleRadius();

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

    return 0;
}

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

typedef pair<double,double>vec;

vec operator + (vec v1,vec v2){
    return make_pair(v1.first+v2.first,v1.second+v2.second);
}
vec operator - (vec v1,vec v2){
    return make_pair(v1.first-v2.first,v1.second-v2.second);
}
vec operator * (double v,vec v2){
    return make_pair(v*v2.first,v*v2.second);
}
vec operator / (vec v1,double d){
    return make_pair(v1.first/d,v1.second/d);
}

double norm2(vec v1,vec v2){
    return (v1-v2).first*(v1-v2).first+(v1-v2).second*(v1-v2).second;
}

int main(){
    double x1,x2,x3,y1,y2,y3,n,r;
    cin>>n;
    while(n--){
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        vec A = make_pair(x1,y1);
        vec B = make_pair(x2,y2);
        vec C = make_pair(x3,y3);
        double a2,b2,c2,a,b,c,cosA,cosB,cosC,sinA,sinB,sinC,cos2A,cos2B,cos2C,sin2A,sin2B,sin2C;
        a2=norm2(B,C);
        b2=norm2(A,C);
        c2=norm2(A,B);
        a=sqrt(a2);
        b=sqrt(b2);
        c=sqrt(c2);
        cosA=(b2+c2-a2)/(2*b*c);
        cosB=(a2+c2-b2)/(2*c*a);
        cosC=(b2+a2-c2)/(2*b*a);
        sinA=sqrt(1-cosA*cosA);
        sinB=sqrt(1-cosB*cosB);
        sinC=sqrt(1-cosC*cosC);
        r=(a/sinA)/2;
        cos2A=cosA*cosA-sinA*sinA;
        cos2B=cosB*cosB-sinB*sinB;
        cos2C=cosC*cosC-sinC*sinC;
        sin2A=2*sinA*cosA;
        sin2B=2*sinB*cosB;
        sin2C=2*sinC*cosC;
        
        vec v=(sin2A*A+sin2B*B+sin2C*C)/(sin2A+sin2B+sin2C);
        printf("%.3f %.3f %.3f\n",v.first,v.second,r);
    }
    

}