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

using namespace std;

void square(double, double, double, double, double, double);
double edge(double, double, double, double);
void center(double, double, double, double, double, double);

double xp, yp;

int main () {

	double x1, y1, x2, y2, x3, y3, n;

	cin >> n;

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

}


void square(double x1, double y1, double x2, double y2, double x3, double y3) {

	double r, a, b, c, s;

	a=edge(x1, x2, y1, y2);
	b=edge(x2, x3, y2, y3);
	c=edge(x3, x1, y3, y1);
	center(x1, y1, x2, y2, x3, y3);
	s=(a+b+c)/2;
	r=0.25*a*b*c/sqrt(s*(s-a)*(s-b)*(s-c));
	printf("%.3f %.3f %.3f\n", xp, yp, r);

}

double edge(double a, double b, double c, double d) {

	return sqrt(pow(a-b, 2)+pow(c-d, 2));

}

void center(double x1, double y1, double x2, double y2, double x3, double 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;
	xp=(b1*c2-b2*c1)/(a1*b2-a2*b1);
	yp=(c1*a2-c2*a1)/(a1*b2-a2*b1);

}

C++: #include <iostream>
#include <cmath>
using namespace std;

//ax+b
struct line
{
	double a;
	double b;
	line(){a=0,b=0;}
	line(double x0, double y0, double x1, double y1)
	{
		a=-(x1-x0)/(y1-y0);
		b=(y0+y1)/2.0-a*(x0+x1)/2.0;
	}
};

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;
		line l[2];

		if(y1==y2)
		{
			l[0] = line(x2,y2,x3,y3);
			l[1] = line(x3,y3,x1,y1);
		}
		else if(y2==y3)
		{
			l[0] = line(x1,y1,x2,y2);
			l[1] = line(x3,y3,x1,y1);
		}
		else
		{
			l[0] = line(x1,y1,x2,y2);
			l[1] = line(x2,y2,x3,y3);
		}
		
		double x = (l[1].b-l[0].b)/(l[0].a-l[1].a);
		double y = l[0].a*x+l[0].b;
		double r = sqrt( (x-x1)*(x-x1) + (y-y1)*(y-y1) );
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;

struct P{
    double x, y;
    double size(){
        return std::sqrt(x*x + y*y);
    }
    double sizeS(){
        return x*x + y*y;
    }
    P toUnit(){
        return {x / size(), y / size()};
    }
    P rotate(int angle){
        if(angle == 0){ // 反時計
            return {-y, x};
        }
        return {y, -x};
    }
};

P operator+(const P& lp, const P& rp){
    return {lp.x+rp.x, lp.y+rp.y};
}

P operator-(const P& lp, const P& rp){
    return {lp.x-rp.x, lp.y-rp.y};
}

P operator*(const P& p, const double& k){
    return {k*p.x, k*p.y};
}

double cross(const P& lp, const P& rp){
    return lp.x * rp.y - lp.y * rp.x;
}

int main(){
    int N;
    std::cin >> N;

    REP(i, N){
        P A, B, C, v1, v2, v3;
        std::cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
        v1 = B - A; v2 = C - A, v3 = B - C;

        double sinA = std::abs(cross(v1, v2)) / (v1.size() * v2.size()),
            r = v3.size() / 2.0 / sinA, k = std::sqrt(r*r-v1.sizeS()/4);

        P m = v1*0.5, p = A + m + m.rotate(cross(A, C) < 0).toUnit() * k;

        printf("%.3f %.3f %.3f\n", p.x, p.y, r);
    }
}

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

using namespace std;

int main(void){
	
	int n;
	double x[3]={0},y[3]={0},r,a,b,c,d[2]={0},e[2]={0},f[2]={0},l,m;

	scanf("%d",&n);

	for(int i=0;i<n;i++){
		
		a=b=c=r=l=m=0;
		for(int i=0;i<2;i++){
			d[i]=e[i]=f[i]=0;
		}
		for(int i=0;i<3;i++){
			x[i]=y[i]=0;
		}

		scanf("%lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);

		a=sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]));	//ツ各ツ陛督づ個陳キツつウ
		b=sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
		c=sqrt((x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]));	
	
		r=a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));			//ツ外ツ静堋円ツづ個板シツ径
		
		d[0]=2*(x[1]-x[0]);
		e[0]=2*(y[1]-y[0]);
		f[0]=x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
		d[1]=2*(x[2]-x[0]);
		e[1]=2*(y[2]-y[0]);
		f[1]=x[0]*x[0]-x[2]*x[2]+y[0]*y[0]-y[2]*y[2];

		l=(e[0]*f[1]-e[1]*f[0])/(d[0]*e[1]-d[1]*e[0]);
		m=(f[0]*d[1]-f[1]*d[0])/(d[0]*e[1]-d[1]*e[0]);

		l=round(l*1000)/1000;
		m=round(m*1000)/1000;
		r=round(r*1000)/1000;
		
		printf("%.03lf %.03lf %.03lf\n",l,m,r);
	}
	return 0;
}

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

typedef double D;
typedef complex<D> P;
const D EPS = 1e-9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;
  return a1 + d1/d2*(a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,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;

    P a, b, c;
    a = P(x1, y1);
    b = P(x2, y2);
    c = P(x3, y3);
    P ansxy = circumcenter(a, b, c);
    printf("%.3f %.3f %.3f\n", ansxy.X, ansxy.Y, hypot(ansxy.X-x1, ansxy.Y-y1));
  }

}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

#define MAX 1000000

using namespace std;

int main()
{
	double x1,y1,x2,y2,x3,y3,X1,Y1,X2,Y2,a1,b1,a2,b2;
	double xp,yp,r;
	int n,f;

	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		f=0;

		X1=(x1+x2)/2.0; Y1=(y1+y2)/2.0;
		X2=(x1+x3)/2.0; Y2=(y1+y3)/2.0;
	
		if(y2-y1!=0){
			if(x2!=x1)a1=-(y2-y1)/(x2-x1);
			else a1=0;
			b1=X1*(-a1)+Y1;
		}else f=1;

		if(y3-y1!=0){
			if(x3!=x1)a1=-(y3-y1)/(x3-x1);
			else a2=0;
			b2=X2*(-a2)+Y2;
		}else if(f!=1) f=2;

		if(f==1){ 
			xp=X1;yp=a2*xp+b2;
		}else if(f==2){
			xp=X2; yp=a1*xp+b1;
		}else{
			xp=(b2-b1)/(a1-a2);
			yp=a1*xp+b1;
		}
		r=sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));

		printf("%f %f %f\n",xp,yp,r);
	}

	return 0;
}