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

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3;
	double xp, yp, r;
	
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++){
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		
		xp = (((x2*x2+y2*y2)-(x3*x3+y3*y3))*(y2-y1)-((x1*x1+y1*y1)-(x2*x2+y2*y2))*(y3-y2)) / (2*((x2-x1)*(y3-y2)-(x3-x2)*(y2-y1)));
		yp = (((y2*y2+x2*x2)-(y3*y3+x3*x3))*(x2-x1)-((y1*y1+x1*x1)-(y2*y2+x2*x2))*(x3-x2)) / (2*((y2-y1)*(x3-x2)-(y3-y2)*(x2-x1)));
		r = sqrt((x1-xp)*(x1-xp) + (y1-yp)*(y1-yp));
		
		printf("%.3lf %.3lf %.3lf\n", xp, yp, r);
	}
	
	return 0;
}

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

int main() {
	int sampleNum;
	scanf("%d", &sampleNum);
	for (; sampleNum > 0; --sampleNum) {
		double x1, y1, x2, y2, x3, y3;
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

		double ax = x2 - x1;
		double ay = y2 - y1;
		double a = sqrt(ax * ax + ay * ay);
		double bx = x3 - x1;
		double by = y3 - y1;
		double b = sqrt(bx * bx + by * by);
		double cx = x3 - x2;
		double cy = y3 - y2;
		double c = sqrt(cx * cx + cy * cy);

		double crossabz = ax * by - ay * bx;
		double crossbcz = bx * cy - by * cx;
		double crosscaz = cx * ay - cy * ax;

		double sinA = crossbcz / (b * c);
		double sinB = crosscaz / (c * a);
		double sinC = crossabz / (a * b);
		double sin2A = sin(2.*asin(sinA));
		double sin2B = sin(2.*asin(sinB));
		double sin2C = sin(2.*asin(sinC));
		double px = (sin2A * x1 + sin2B * x2 + sin2C * x3) / (sin2A + sin2B + sin2C);
		double py = (sin2A * y1 + sin2B * y2 + sin2C * y3) / (sin2A + sin2B + sin2C);

		double s = abs(crossabz) / 2.;
		double r = a * b * c / (4. * s);

		printf("%.3lf %.3lf %.3lf\n", px, py, r);
	}
	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>
#include <chrono>

using namespace std;

class circleOfATriangle
{
public:
	void calc(double,double,double,double,double,double);
};

void circleOfATriangle::calc(double x1, double y1, double x2, double y2, double x3, double y3)
{
	double a2 = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
	double b2 = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3);
	double c2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
	double area = ((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)) / 2.0;

	double px = (a2*(b2 + c2 - a2)*x1 + b2*(c2 + a2 - b2)*x2 + c2*(a2 + b2 - c2)*x3) / (16 * area*area);
	double py = (a2*(b2 + c2 - a2)*y1 + b2*(c2 + a2 - b2)*y2 + c2*(a2 + b2 - c2)*y3) / (16 * area*area);
	double r = sqrt((x1 - px)*(x1 - px) + (y1 - py)*(y1 - py));
	
	cout << fixed << setprecision(3) << px << " " << py << " " << r << "\n";
}

int main()
{
	circleOfATriangle ct;
	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;
		ct.calc(x1,y1,x2,y2,x3,y3);
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define int long

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

constexpr int dx[4] = { 1, 0, -1, 0 };
constexpr int dy[4] = { 0, 1, 0, -1 };

//----------------------------------
//----------------------------------

template<typename STL> inline void print_STL(STL c, string ab = ""){
	cout << ab << c[0];
	for(int i = 1; i < c.size(); ++i) cout << ' ' << c[i]; }

template<typename STL> inline void import_STL(STL& c, int n){
	typename STL::value_type tmp;
	for(int i = 0; i < n; ++i){	cin >> tmp; c.push_back(tmp);} }

istream& operator>>(istream& os, pair<double,double>& x)
{
	double tmp;
	os >> tmp;
	x.first = tmp;
	os >> tmp;
	x.second = tmp;
	return os;
}

ostream& operator<<(ostream& os, pair<double,double>& x)
{
	return os << x.first << ' ' << x.second;
}

pair<double, double> operator-(pair<double,double> a, pair<double,double> b)
{
	return {a.first - b.first, a.second - b.second};
}
pair<double, double> operator+(pair<double,double> a, pair<double,double> b)
{
	return {a.first + b.first, a.second + b.second};
}

double operator*(pair<double, double> a, pair<double,double> b)
{
	return a.first * b.first + a.second * b.second;
}
double sq(double a)
{
	return a * a;
}

double round4(double x)
{
	x *= 1000;
	x = (int)(x + 0.5);
	return x / 1000.;
}

signed main()
{
	pair<double,double> a, b, c;
	int n;
	cin >>n;
	for(int i = 0; i < n; ++i)
	{
		cin >> a >> b >> c;
		pair<double, double> va = b-c, vb = c-a;
		/* cout << va <<' ' << vb << '\n'; */
		/* auto m = b + c, n = c + a; */
		/* m = {m.first / 2, m.second/2}; */
		/* n = {n.first / 2, n.second/2}; */
		double norm = va.first * vb.second - va.second * vb.first;
		/* double cx = va * m , cy = vb * n ; */
		double cx = sq(b.first) + sq(b.second) - sq(c.first) - sq(c.second);
		double cy = sq(c.first) + sq(c.second) - sq(a.first) - sq(a.second);
		cx /= 2;
		cy /= 2;
		double sx = cx * vb.second - cy * va.second;
		double sy = va.first * cy - cx * vb.first;
		sx /= norm;
		sy /= norm;

		double r = sqrt(sq(c.first - sx)+ sq(c.second - sy));
		sx = round4(sx);
		sy = round4(sy);
		r = round4(r);
		printf("%.3lf %.3lf %.3lf\n", sx, sy, r);
	}
}

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

using namespace std;

#define reep(i, a, n) for(int i = a;i < n; i++)
#define rep(i, n) reep(i, 0, n)

double pow2(double in){
    return in * in;
}

double distance(double x1, double y1, double x2, double y2){
    return sqrt(pow2(y2 - y1) + pow2(x2 - x1));
}

int main(){
    
    int n;
    double x[3], y[3], a, b, cx, cy, r, X[2], Y[2], al, be, cal, ca, sa;
    
    scanf("%d", &n);
    
    rep(i, n){
        
        rep(j, 3){
            scanf("%lf %lf", &x[j], &y[j]);
        }
        
        ca = (pow2(distance(x[0], y[0], x[1], y[1])) 
ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　+ pow2(distance(x[1], y[1], x[2], y[2])) 
ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　ツ　- pow2(distance(x[2], y[2], x[0], y[0])))
ツ　ツ　ツ　ツ　ツ　 / (2.0 * distance(x[0], y[0], x[1], y[1]) * distance(x[1], y[1], x[2], y[2]));
        
        sa = sqrt(1.0 - pow2(ca));
        
        r = distance(x[2], y[2], x[0], y[0]) / sa;
        
        r /= 2.0;
        
        X[0] = x[1] - x[0];
        X[1] = x[2] - x[0];
        Y[0] = y[1] - y[0];
        Y[1] = y[2] - y[0];
        
        al = -(pow2(x[0]) - pow2(x[1]) + pow2(y[0]) - pow2(y[1]));
        be = -(pow2(x[0]) - pow2(x[2]) + pow2(y[0]) - pow2(y[2]));
        
        cal = (X[0] * Y[1] - X[1] * Y[0]) * 2.0;
        
        cx = (Y[1] * al - Y[0] * be) / cal;
        cy = (X[0] * be - X[1] * al) / cal;
        
        printf("%.3lf %.3lf %.3lf\n", cx, cy, r);
        
    }
    
    return 0;
}