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<cmath>
#include<stdio.h>
using namespace std;
int main() {
  int n=0,p,q,r;
  double ax=0,ay=0,bx=0,by=0,cx=0,cy=0,S=0,R=0,a=0,b=0,c=0,x=0,y=0;
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>ax>>ay>>bx>>by>>cx>>cy;
    S=abs(((bx-ax)*(cy-ay)-(cx-ax)*(by-ay))/2);
    a=sqrt((cx-bx)*(cx-bx)+(cy-by)*(cy-by));
    b=sqrt((cx-ax)*(cx-ax)+(cy-ay)*(cy-ay));
    c=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
    R=a*b*c/(4*S);
    x=(a*a*(b*b+c*c-a*a)*ax+b*b*(c*c+a*a-b*b)*bx+c*c*(a*a+b*b-c*c)*cx)/(16*S*S);
    y=(a*a*(b*b+c*c-a*a)*ay+b*b*(c*c+a*a-b*b)*by+c*c*(a*a+b*b-c*c)*cy)/(16*S*S);
    printf("%.3f %.3f %.3f\n",x,y,R);
  }
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double EPS=1e-10;
double add(double a, double b)
{
	if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;
	return a+b;
}

int main()
{
	int n ; cin >> n ;
	while(n--)
	{
		double x[3],y[3]; for(int i=0;i<3;i++) cin >> x[i] >> y[i] ;
		double a=x[1]-x[0];
		double b=y[1]-y[0];
		double d=x[2]-x[1];
		double e=y[2]-y[1];
		double c=add(-add(x[1]*x[1],-x[0]*x[0])/2,-add(y[1]*y[1],-y[0]*y[0])/2);
		double f=add(-add(x[2]*x[2],-x[1]*x[1])/2,-add(y[2]*y[2],-y[1]*y[1])/2);
		double X=add(b*f,-c*e)/add(a*e,-b*d);
		double Y=add(c*d,-a*f)/add(a*e,-b*d);
		double r=sqrt( add( (X-x[0])*(X-x[0]),(Y-y[0])*(Y-y[0]) ) );
		cout << fixed << setprecision(3) << X  << ' ' << Y << ' ' << r << '\n';
	}
}

C++: #include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;

#define EPS 1.0e-6

const double EPS = 1e-7;
typedef complex<double> P; /* _ */
struct L {                 /* üª */
	P p, q;
	L(P p, P q) : p(p), q(q) {}
};

double cross(P a, P b) { return imag(conj(a)*b); }

// ¼üaÆ¼übÌð_ðvZ·éDæÉð·»èªK{D
P crossPointLL(L a, L b){
	double A = cross(a.q-a.p, b.q-b.p);
	double B = cross(a.q-a.p, a.q-b.p);
	return b.p + B/A * (b.q-b.p);
}

// _pÆ_qÌ¼ñªüðÔ·
L pointBisector(P p, P q) {
	P cen = (p+q)*0.5;
	return L(cen, cen+(q-p)*P(0,1));
}

int main(){
	int n;
	cin>>n;
	double x1, y1, x2, y2, x3, y3;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3){
		// Cuè@
		P p1 = P(x1, y1);
		P p2 = P(x2, y2);
		P p3 = P(x3, y3);
		L l1 = pointBisector(p1, p2);
		L l2 = pointBisector(p2, p3);
		P cen = crossPointLL(l1, l2);
		double r = abs(p1-cen);

		// Êè@
		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 cx = (b1*c2-b2*c1)/(a1*b2-a2*b1);
		double cy = (c1*a2-c2*a1)/(a1*b2-a2*b1);
		P cen2 = P(cx, cy);
		double r2 = abs(p1-cen2);

		// ÜÆß
		int x1000 = 1000*cen2.real()+0.5;
		int y1000 = 1000*cen2.imag()+0.5;
		int r1000 = 1000*r2+0.5;
		printf("%.3f %.3f %.3f", 1.0*x1000/1000+EPS, 1.0*y1000/1000+EPS, 1.0*r1000/1000+EPS);
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {

	int n;
	double x1, x2, x3, y1, y2, y3;
	double X, Y, R;
	double a, b, c, d;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		a = x2 - x1;
		b = x3 - x1;
		c = y2 - y1;
		d = y3 - y1;
	
		X = 0.5*((a*a*d - b*b*c) + c*d*(d - c)) / (a*d - b*c);
		Y = 0.5*(a*b*(a - b) + (b*c*c - a*d*d)) / (b*c - a*d);
		R = sqrt(X*X + Y*Y);

		X += x1;
		Y += y1;
		

		
		printf("%.3lf %.3lf %.3lf\n", X/1000 , Y /1000, R /1000);
	}

	return 0;
}

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

typedef pair<double,double>vec;

vec operator + (vec v1,vec v2){
    return make_pair(v1.first+v2.first,v1.second+v2.second);
}

vec operator - (vec v1,vec v2){
    return make_pair(v1.first-v2.first,v1.second-v2.second);
}

vec operator * (double v,vec v2){
    return make_pair(v*v2.first,v*v2.second);
}

vec operator / (vec v1,double d){
    return make_pair(v1.first/d,v1.second/d);
}

int norm2(vec v1,vec v2){
    return (v1-v2).first*(v1-v2).first+(v1-v2).second*(v1-v2).second;
}

int main(){
    double x1,x2,x3,y1,y2,y3,n,r;
    cin>>n;
    while(n--){
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        vec A = make_pair(x1,y1);
        vec B = make_pair(x2,y2);
        vec C = make_pair(x3,y3);
        double a2,b2,c2,a,b,c,cosA,cosB,cosC,sinA,sinB,sinC,cos2A,cos2B,cos2C,sin2A,sin2B,sin2C;
        a2=norm2(B,C);
        b2=norm2(A,C);
        c2=norm2(A,B);
        a=sqrt(a2);
        b=sqrt(b2);
        c=sqrt(c2);
        cosA=(b2+c2-a2)/(2*b*c);
        cosB=(a2+c2-b2)/(2*c*a);
        cosC=(b2+a2-c2)/(2*b*a);
        sinA=sqrt(1-cosA*cosA);
        sinB=sqrt(1-cosB*cosB);
        sinC=sqrt(1-cosC*cosC);
        r=(a/sinA)/2;
        cos2A=cosA*cosA-sinA*sinA;
        cos2B=cosB*cosB-sinB*sinB;
        cos2C=cosC*cosC-sinC*sinC;
        sin2A=2*sinA*cosA;
        sin2B=2*sinB*cosB;
        sin2C=2*sinC*cosC;
        
        vec v=(sin2A*A+sin2B*B+sin2C*C )   /    (sin2A+sin2B+sin2C);
        printf("%.3f %.3f %.3f\n",v.first,v.second,r);
    }
    
}

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

//#define P(p) pow 

using namespace std;

int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		array<pair<double,double>,3>p;
		cin>>p[0].first>>p[0].second>>p[1].first>>p[1].second>>p[2].first>>p[2].second;

		pair<long double, long double >o(
			 ((p[2].second - p[1].second) * (pow(p[1].first, 2.0) - pow(p[0].first, 2.0) + pow(p[1].second, 2.0) - pow(p[0].second, 2.0)) - (p[1].second - p[0].second) * (pow(p[2].first, 2.0) - pow(p[1].first, 2.0) + pow(p[2].second, 2.0) - pow(p[1].second, 2.0))) / (2.0 * ((p[1].first - p[0].first) * (p[2].second - p[1].second) - (p[1].second - p[0].second) * (p[2].first - p[1].first))),
                (- (p[2].first - p[1].first) * (pow(p[1].first, 2.0) - pow(p[0].first, 2.0) + pow(p[1].second, 2.0) - pow(p[0].second, 2.0)) + (p[1].first - p[0].first) * (pow(p[2].first, 2.0) - pow(p[1].first, 2.0) + pow(p[2].second, 2.0) - pow(p[1].second, 2.0))) / (2.0 * ((p[1].first - p[0].first) * (p[2].second - p[1].second) - (p[1].second - p[0].second) * (p[2].first - p[1].first)))
				);

		long double r=sqrt(pow(p[0].first - o.first, 2) + pow(p[0].second - o.second, 2));

		cout<<fixed<<setprecision(3)<<o.first<<" "<<o.second<<" "<<r<<endl;
	}
	return 0;
	
}