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<cmath>

using namespace std;

int main(){
	int n,i;
	double x1, y1, x2, y2, x3, y3;
	double det, s, t, px, py, r;

	// データセット数の入力
	cin >> n;

	// 処理
	for(i=0;i<n;i++){
		// 3点の座標の入力
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		// det の計算
		det = ((y3 - y2) * (x3 - x1)) - ((y1 - y3) * (x2 - x3));
		// det ≠ 0 かどうかチェック
		if(det == 0){
			cerr << "逆行列が存在しません" << endl;
			i--;
			break;
		}
		// 予備計算
		s = ((x3 - x1) * (x1 - x2)) + ((y3 - y1) * (y1 - y2));
		t = ((x3 - x2) * (x1 - x2)) + ((y3 - y2) * (y1 - y2));
		s /= (det * 2);
		t /= (det * 2);
		// 中心座標の計算
		px = ((x2 + x3) / 2) + s * (y3 - y2);
		py = ((y2 + y3) / 2) + s * (x2 - x3);
		// 距離の計算
		r = sqrt(((px - x1) * (px - x1)) + ((py - y1) * (py - y1)));
		// 出力
		printf("%.3f %.3f %.3f\n", px, py, r);
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
long n,i;
double x1,y1,x2,y2,x3,y3,xx,yy,rr,s;
cin>>n;
for(i=0;i<n;i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3;
if(cin.eof())break;
x1-=x3;x2-=x3;
y1-=y3;y2-=y3;
s=(x1*x2+y1*y2-x2*x2-y2*y2)/(x1*y2-x2*y1);
xx=x1*.5+s*y1;
yy=y1*.5-s*x1;
rr=sqrt(xx*xx+yy*yy);
xx+=x3;
yy+=y3;
printf("%.3f %.3f %.3f\n",xx,yy,rr);
}
return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#define X real()
#define Y imag()

typedef complex<double> P;
class C:public P{
	public:
	double r;
	C(double x,double y,double r):P(x,y),r(r){}
};

template<class T> sq(T x){return x*x;}
double dot(P a, P b){return a.X*b.X + a.Y*b.Y;}

P solve_eq2(double a,double b,double c,double d,double e,double f){
	double A = a*e-b*d;
	return P((c*e-b*f)/A, (a*f-c*d)/A);
}

C C_PPP(P a,P b,P c){
	P d = b-a;
	P e = c-a;
	
	double z1 = -dot(a,a);
	double z2 = -dot(b,b);
	double z3 = -dot(c,c);
	
	P f = solve_eq2(d.X, d.Y, z2-z1, e.X, e.Y, z3-z1);
	double u = z1-dot(a,f);
	
	return C(-f.X/2, -f.Y/2, sqrt(dot(f,f)/4-u));
}

int main(){
	
	int n;
	cin>>n;
	
	rep(i,n){
		double xa,ya,xb,yb,xc,yc;
		cin>>xa>>ya>>xb>>yb>>xc>>yc;
		
		C circle = C_PPP(P(xa,ya),P(xb,yb),P(xc,yc));
		
		printf("%.3lf %.3lf %.3lf\n",circle.X,circle.Y,circle.r);
	}
}

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

using namespace std;

int main(){
	
    int n;
    cin >> n;
    while(n--) {
    	
        double x1, y1, x2, y2, x3, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        
        double a1 = 2 * (x2 - x1);
        double b1 = 2 * (y2 - y1);
        double c1 = x1 * x1 -x2 * x2 + y1 * y1 - y2 * y2;
        
        double a2 = 2 * (x3 - x1);
        double b2 = 2 * (y3 - y1);
        double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
        
        double x = (b1  *c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        double y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        double r = hypot(x-x1, y-y1);
        
        cout << fixed << setprecision(3) 
        	 << x << " " << y << " " << r << "\n";
        
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);

using Point = complex<double>;
using Polygon = vector<Point>;

inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }

inline bool eq(const Point &a, const Point &b) { return abs(a - b) < EPS; }

inline bool operator<(const Point &a, const Point &b){
    if (sgn(a.real() - b.real()))
        sgn(a.real() - b.real()) < 0;
    return sgn(a.imag() - b.imag());
}

double dot(const Point &a, const Point &b) { return real(conj(a) * b); }

double det(const Point &a, const Point &b) { return imag(conj(a) * b); }

struct Line {
    Point p1, p2;

    Line(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}

    bool operator<(const Line &rhs) const {
        if (eq(p2, rhs.p2))
            return p1 < rhs.p1;
        return p2 < rhs.p2;
    }
    bool operator==(const Line &rhs) const {
        return (eq(p1, rhs.p1) && eq(p2, rhs.p2)) ||
               (eq(p1, rhs.p2) && eq(p2, rhs.p1));
    }
};

Point circumcenter(Point p1, Point p2, Point p3) {
  double a1, b1, c1, a2, b2, c2, cx, cy;
  a1 = real(p2 - p1);
  b1 = imag(p2 - p1);
  c1 = norm(p2) - norm(p1);
  a2 = real(p3 - p2);
  b2 = imag(p3 - p2);
  c2 = norm(p3) - norm(p2);
  cx = (b2 * c1 - b1 * c2) / (2.0 * (a1 * b2 - a2 * b1));
  cy = (a1 * c2 - a2 * c1) / (2.0 * (a1 * b2 - a2 * b1));
  return Point(cx, cy);
}

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;
        Point c = circumcenter(Point(x1,y1),Point(x2,y2),Point(x3,y3));
        double r = abs(Point(x1,y1) - c);
        printf("%.3f %.3f %.3f\n",c.real(),c.imag(),r);
    }

    return 0;
}

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

int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		double x1,y1,x2,y2,x3,y3;
		scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
		double a1 = 2*(x2 - x1), b1 = 2*(y2 - y1);
		double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
		double a2 = 2*(x3-x1), b2 = 2*(y3-y1);
		double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
		double x = (b1*c2 - b2*c1)/(a1*b2 - a2*b1);
		double y = (c1*a2 - c2*a1)/(a1*b2 - a2*b1);
		double r = hypot(x-x1,y-y1);
		printf("%.3lf %.3lf %.3lf\n",x,y,r);
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		double x[3], y[3];		// three points
		for( int i = 0; i < 3; i++ ){
			cin >> x[i] >> y[i];
		}
		double a[2];		// the slope of a line
		double b[2];		// the intersept of a line
		double ax, ay;
		int s = 0;
		for( int i = 0; i < 2; i++ ){
			if( y[i] == y[i+1] ){
				s = i+1;
			}else{
				a[i] = -(x[i] - x[i+1]) / (y[i] - y[i+1]);
				b[i] = (y[i] + y[i+1]) / 2.0 - a[i] * (x[i] + x[i+1]) / 2.0;
			}
		}
		if( a[0] == 0 ){
			ay = b[0];
			ax = ( ay - b[1] ) / a[1];
			if( s == 2){
				ax = ( x[1] + x[2] ) / 2;
				ay = a[0] * ax + b[0];
			}else if( s == 1 ){
				ax = ( x[0] + x[1] ) / 2;
				ay = a[1] * ax + b[1];
			}else{
				ax = ( b[1] - b[0] ) / ( a[0] - a[1] );
				ay = a[0] * ax + b[0];
			}
		}else if( a[1] == 0 ){
			ay = b[1];
			ax = ( ay - b[0] ) / a[0];
			if( s == 2){
				ax = ( x[1] + x[2] ) / 2;
				ay = a[0] * ax + b[0];
			}else if( s == 1 ){
				ax = ( x[0] + x[1] ) / 2;
				ay = a[1] * ax + b[1];
			}else{
				ax = ( b[1] - b[0] ) / ( a[0] - a[1] );
				ay = a[0] * ax + b[0];
			}
		}else{
			if( s == 2){
				ax = ( x[1] + x[2] ) / 2;
				ay = a[0] * ax + b[0];
			}else if( s == 1 ){
				ax = ( x[0] + x[1] ) / 2;
				ay = a[1] * ax + b[1];
			}else{
				ax = ( b[1] - b[0] ) / ( a[0] - a[1] );
				ay = a[0] * ax + b[0];
			}
		}
		double r = sqrt( pow( x[0] - ax, 2 ) + pow( y[0] - ay, 2 ) );
		printf("%.3f %.3f %.3f\n", ax, ay, r );
	}
}