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<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<iomanip>
using namespace std;
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;
  
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
  
class Point{
    public:
        double x, y;
  
        Point(double x = 0, double y = 0): x(x), y(y) {}
  
        Point operator + (Point p){ return Point(x + p.x, y + p.y);}
        Point operator - (Point p){ return Point(x - p.x, y - p.y);}
        Point operator * (double a){ return Point(a * x, a * y);}
        Point operator / (double a){ return Point(x / a, y / a);}
  
        double abs(){ return sqrt(norm());}
        double norm(){ return x * x + y * y;}
  
        bool operator < (const Point &p) const{
            return x != p.x ? x < p.x : y < p.y;
        }
  
        bool operator == (const Point &p) const{
            return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
        }
};
  
struct Segment {
    Point p1, p2;
};
typedef Segment Line;
  
class Circle{
    public:
        Point c;
        double r;
        Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};
  
typedef Point Vector;
typedef vector<Point> Polygon;
  
double dot(Vector a, Vector b){
    return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){
    return a.x * b.y - a.y * b.x;
}
  
Point project(Segment s, Point p){
    Vector base = s.p2 - s.p1;
    double r = dot(p - s.p1, base) / base.norm();
    return s.p1 + base * r;
}
  
Point getCrossPoint(Segment s1, Segment s2){
    Vector base = s2.p2 - s2.p1;
    double d1 = abs(cross(base, s1.p1 - s2.p1));
    double d2 = abs(cross(base, s1.p2 - s2.p1));
    double t = d1 / (d1 + d2);
    return s1.p1 + (s1.p2 - s1.p1) * t;
}
  
double getDistance(Point a, Point b){
    return (a - b).abs();
}
  
pair<Point, Point> getCrossPoints(Circle c, Line l){
    Vector pr = project(l, c.c);
    Vector e = (l.p2 - l.p1) / (l.p2 - l.p1).abs();
    double base = sqrt(c.r * c.r - (pr - c.c).norm());
    return make_pair(pr + e * base, pr - e * base);
}
  
double arg(Vector p){return atan2(p.y, p.x);}
Vector polar(double a, double r){return Point(cos(r) * a, sin(r) * a);}
  
pair<Point, Point> getCrossPoints(Circle c1, Circle c2){
    double d = (c1.c - c2.c).abs();
    double a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    double t = arg(c2.c - c1.c);
    return make_pair(c1.c + polar(c1.r, t + a), c1.c + polar(c1.r, t - a));
}
  
int main(){
    int n;
    Point p[3];
    cin >> n;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 3; j++){
            cin >> p[j].x >> p[j].y;
        }
        pair<Point, Point> pp = getCrossPoints((Circle){p[0], 400.0}, (Circle){p[1], 400.0});
        pair<Point, Point> pp2 = getCrossPoints((Circle){p[0], 400.0}, (Circle){p[2], 400.0});
        Point P = getCrossPoint((Line){pp.first, pp.second}, (Line){pp2.first, pp2.second});
        printf("%.3f %.3f %.3f\n", P.x, P.y, getDistance(p[0], P));
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

int main()
{
    const double EPS = 1.0e-10;
    double a,b,c,d,e,f;
    double x1,x2,x3,y1,y2,y3;
    double x,y,r;
    int n;
	cin >> n;
    for(int i = 0; i < n; i++){
    	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        a = x1 - x2;
        b = y1 - y2;
        c = (x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2) / 2;
        d = x1 - x3;
        e = y1 - y3;
        f = (x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3) / 2;
        x = (e * c - b * f) / (a * e - b * d);
        y = (a * f - d * c) / (a * e - b * d);
    	r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
        if(-0.0005 < x && x < 0.0+EPS) x = 0.0;
        if(-0.0005 < y && y < 0.0+EPS) y = 0.0;
 
        printf("%.3f %.3f %.3f\n",x,y,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, x2, px, py);

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

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

    return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
double GetLen(double x1,double y1,double x2,double y2){
  return sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
}
main(){
  int n;
  double x1,y1,x2,y2,x3,y3; 
  double R,rx,ry;
  double a,b,c,a1,b1,c1,a2,b2,c2;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
    a=GetLen(x1,y1,x2,y2);
    b=GetLen(x2,y2,x3,y3);
    c=GetLen(x3,y3,x1,y1);
    R=(a*b*c)/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
    a1=2*(x2-x1);
    b1=2*(y2-y1);
    c1=x1*x1-x2*x2+y1*y1-y2*y2;
    a2=2*(x3-x1);
    b2=2*(y3-y1);
    c2=x1*x1-x3*x3+y1*y1-y3*y3;
    rx=(b1*c2-b2*c1)/(a1*b2-a2*b1);
    ry=(c1*a2-c2*a1)/(a1*b2-a2*b1);
    printf("%.3f %.3f %.3f\n",rx,ry,R);
  }
}