Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

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

struct Vector2D {
	double x, y;

	Vector2D() : x(0.0), y(0.0) {}
	Vector2D(double vx, double vy) : x(vx), y(vy) {}
	Vector2D& operator+=(const Vector2D& rhs)
	{
		x += rhs.x;
		y += rhs.y;
		return *this;
	}
	Vector2D& operator-=(const Vector2D& rhs)
	{
		x -= rhs.x;
		y -= rhs.y;
		return *this;
	}
	Vector2D& operator*=(double rhs)
	{
		x *= rhs;
		y *= rhs;
		return *this;
	}
};

Vector2D operator+(const Vector2D& lhs, const Vector2D& rhs)
{
	Vector2D result(lhs);
	return result += rhs;
}

Vector2D operator-(const Vector2D& lhs, const Vector2D& rhs)
{
	Vector2D result(lhs);
	return result -= rhs;
}

Vector2D operator*(double lhs, const Vector2D& rhs)
{
	Vector2D result(rhs);
	return result *= lhs;
}

void solve(Vector2D p1, Vector2D p2, Vector2D p3, Vector2D& center, double& radius)
{
	// p3-base p1, p3-base p2
	Vector2D r1(p1 - p3), r2(p2 - p3);

	double det = r2.x * r1.y - (-r1.x) * r2.y;
	double a = (r2.x * (r2.x - r1.x) + r2.y * (r1.y - r2.y)) * 0.5 / det;

	center = p3 + (0.5 * r1 + a * Vector2D(r1.y, -r1.x));

	Vector2D r = p1 - center;
	radius = std::sqrt(r.x * r.x + r.y * r.y);
}

int main()
{
	int count = 0;
	std::cin >> count;
	for (int i = 0; i < count; ++i) {
		Vector2D p1,p2,p3;
		std::cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
		if (!std::cin.good()) {
			break;
		}
		Vector2D center;
		double radius = 0.0;
		solve(p1, p2, p3, center, radius);
		std::printf("%.3f %.3f %.3f\n", center.x, center.y, radius);
	}

	return 0;
}

C++: #include <stdio.h>
#include <math.h>

using namespace std;


int main() {
	int n;
	double x1, x2, x3, y1, y2, y3, ox, oy, r;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
		ox = ((y2 - y1) * ((y3 * y3 - y1 * y1) + (x3 * x3 - x1 * x1)) - (y3 - y1) * ((y2 * y2 - y1 * y1) + (x2 * x2 - x1 * x1))) /
			(2 * ((x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1)));
		if (y2 != y1) {
			oy = (2 * (x1 - x2) * ox + (y2 * y2 - y1 * y1) + (x2 * x2 - x1 * x1)) / (2 * (y2 - y1));
		}
		else {
			oy = (2 * (x1 - x3) * ox + (y3 * y3 - y1 * y1) + (x3 * x3 - x1 * x1)) / (2 * (y3 - y1));
		}

		r = sqrt((ox - x1) * (ox - x1) + (oy - y1) * (oy - y1));
		printf("%.3lf %.3lf %.3lf\n", ox, oy, r);
	}
	return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;
 
double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;
 
    ret = cross(p1,p2)/2.0;
     
    return abs(ret);
}
 
int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
         
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        printf("%.3lf %.3lf %.3lf\n",X,Y,R);
 
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
#define square(x) (x)*(x)
// ????????±?????£???????????¬????????????????????£???
// ??????????????°????±?????????¨????????¬????????????????±??????£?????????.
// ????????¬????????????????????£???????????????????????????????????????.


int main(){
	int n;
	cin >> n;
	vector<pair<double,double> > x(3);
	vector<double> d(3),r(3);
	pair<double,double> ans;
	double R;
	rep(j,n){
		rep(i,3){
			cin >> x[i].fi >> x[i].se;
		}
		d[0] = square(x[2].fi-x[1].fi) + square(x[2].se-x[1].se);
		d[1] = square(x[2].fi-x[0].fi) + square(x[2].se-x[0].se);
		d[2] = square(x[0].fi-x[1].fi) + square(x[0].se-x[1].se);
		r[0] = d[0]*(d[1]+d[2]-d[0]);
		r[1] = d[1]*(d[2]+d[0]-d[1]);
		r[2] = d[2]*(d[0]+d[1]-d[2]);
		R = r[0]+r[1]+r[2];
		ans.fi = (r[0]*x[0].fi+r[1]*x[1].fi+r[2]*x[2].fi)/R;
		ans.se = (r[0]*x[0].se+r[1]*x[1].se+r[2]*x[2].se)/R;
		R = square(x[0].fi-ans.fi) + square(x[0].se-ans.se);
		printf("%.3f %.3f %.3f\n",ans.fi,ans.se, sqrt(R));
	}
}

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

using namespace std;
typedef struct { double x; double y;} point;
 
point getCircumcenter(point a, point b, point c)
{
    double A1 = 2 * ( b.x - a.x );
    double B1 = 2 * ( b.y - a.y );
    double C1 = pow(a.x,2)-pow(b.x,2) + pow(a.y,2)-pow(b.y,2);
    double A2 = 2 * ( c.x - a.x );
    double B2 = 2 * ( c.y - a.y );
    double C2 = pow(a.x,2)-pow(c.x,2) + pow(a.y,2)-pow(c.y,2);
    double X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1);
    double Y = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1);
	point P;
	P.x=X;
	P.y=Y;
    return P;
}

double getTwoPointDictance(point a, point b)
{
	return fabs(sqrt(pow((a.x-b.x),2)+pow((a.y-b.y),2)));
}
double AntiMinusZero(double n)
{
	if(n=0)
	{
		return 0;
	}
	return n;
}

int main()
{
    int n;
    cin>>n;
    point a,b,c;
    while(n--)
	{
        cin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y;
        point ans = getCircumcenter(a,b,c);
        printf("%.3lf %.3lf %.3lf", AntiMinusZero(ans.x), AntiMinusZero(ans.y), getTwoPointDictance( a, ans));
    }
}