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 <cmath>
using namespace std;

class Point {
public:
  double x, y;
  Point(double x=0, double y=0) : x(x), y(y) {}
};

double dist(Point p1, Point p2) {
  return sqrt(pow(p1.x-p2.x, 2.0)+pow(p1.y-p2.y, 2.0));
}

double LawOfCosines(double a, double b, double c) {
  return acos( (b*b+c*c-a*a) / (2.0*b*c) );
}

Point circumcenter(Point pa, Point pb, Point pc) {
  /*
  double A = abs(atan2(pb.y-pa.y, pb.x-pa.x) - atan2(pc.y-pa.y, pc.x-pa.x));
  double B = abs(atan2(pa.y-pb.y, pa.x-pb.x) - atan2(pc.y-pb.y, pc.x-pb.x));
  double C = abs(atan2(pa.y-pc.y, pa.x-pc.x) - atan2(pb.y-pc.y, pb.x-pc.x));
  */
  double a = dist(pb, pc);
  double b = dist(pa, pc);
  double c = dist(pa, pb);
  double A = LawOfCosines(a, b, c);
  double B = LawOfCosines(b, c, a);
  double C = LawOfCosines(c, a, b);
  return Point((pa.x*sin(A*2)+pb.x*sin(B*2)+pc.x*sin(C*2))
	       /(sin(A*2)+sin(B*2)+sin(C*2)),
	       (pa.y*sin(A*2)+pb.y*sin(B*2)+pc.y*sin(C*2))
	       /(sin(A*2)+sin(B*2)+sin(C*2))
	       );
}

main() {
  Point p[3];
  Point op;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < 3; j++) cin >> p[j].x >> p[j].y;
    op = circumcenter(p[0], p[1], p[2]);
    /*double A = abs(atan2(p[1].y-p[0].y, p[1].x-p[0].x)
		   - atan2(p[2].y-p[0].y, p[2].x-p[0].x));*/
    printf("%.3f %.3f %.3f\n", op.x, op.y, dist(op,p[0]));
  }
}

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

double a,b,c,d,e,f,x,y,r;
int n;

double ifof(double a){
	int n = a*10000;
	if(n%10 >= 5)
		n+=10;
	else if(n%10 <= -5)
		n-=10;
	return n/10000.0;
}

double solvex(){
	double k,l;
	k = ((f-d)*(c*c-a*a+d*d-b*b))-((d-b)*(e*e-c*c+f*f-d*d));
	l = (2*(((f-d)*(c-a))-((d-b)*(e-c))));
	return k/l;
}

double solvey(){
	double k,l;
	k = (e*e-c*c+f*f-d*d-2*(e-c)*x);
	l = (2*(f-d));
	return k/l;
}

int main(){
	std::cin >> n;
	for(int i=0; i<n; i++){
		std::cin >> a >> b >> c >> d >> e >> f;
		x = solvex();
		y = solvey();
		r = std::sqrt(((x-a)*(x-a)) + ((y-b)*(y-b)));
		std::printf("%.3f %.3f %.3f\n",ifof(x),ifof(y),ifof(r));
	}
	return 0;
}

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++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
  
int main(){
    
    int num;
    cin >> num;
    for(int i = 0; i<num; i++) {
        double x1, y1, x2, y2, x3, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        double p = ((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));
  
        double q = ((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));
  
        double r1 = sqrt( (p-x1)*(p-x1) + (q - y1)*(q - y1) );
        double r2 = sqrt( (p-x2)*(p-x2) + (q - y2)*(q - y2) );
        double r3 = sqrt( (p-x3)*(p-x3) + (q - y3)*(q - y3) );
        double r = ( r1 + r2 + r3 ) / 3.0;
  
        cout << showpoint << fixed << setprecision(3);
        cout << p << " " << q << " " << r << endl;
        
        return 0;
    }
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double a = -x1 + x2, b = -y1 + y2, c = (-pow(x1, 2) - pow(y1, 2) + pow(x2, 2) + pow(y2, 2)) / 2;
		double d = -x1 + x3, e = -y1 + y3, f = (-pow(x1, 2) - pow(y1, 2) + pow(x3, 2) + pow(y3, 2)) / 2;
		double y = (c*d - a*f) / (b*d - a*e);
		double x = (f - e*y) / d;
		cout <<fixed<<setprecision(3)<< x << " " << y <<" "<< hypot(x1 - x, y1 - y) << endl;
	}
}