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<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
#define PI M_PI
double GetLen(double x1,double y1,double x2,double y2){
  return sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
}
double GetAn(double x1,double y1,double x2,double y2){
  return atan((y2-y1)/(x2-x1));
}
double GetRadToAn(double rd){
  return rd*(180/PI);
}
double GetAnToX(double an,double len){
  return cos(an)*len;
}
double GetAnToY(double an,double len){
  return sin(an)*len;
}
main(){
  int n;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    double x1,y1,x2,y2,x3,y3; 
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
    double R;
    double a,b,c;
    a=GetLen(x1,y1,x2,y2);
    b=GetLen(x2,y2,x3,y3);
    c=GetLen(x3,y3,x1,y1);
    R=(a*b*c)/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
    double an1=GetAn(x1,y1,x2,y2);
    double x4,y4;
    double h=a/2.0;
    x4=GetAnToX(an1,h)+x1;
    y4=GetAnToY(an1,h)+y1;
    double z=sqrt(R*R-h*h);
    double an2=an1-PI/2.0;
    double an3=an1+PI/2.0;

    double rx,ry;
    rx=GetAnToX(an3,z)+x4;
    ry=GetAnToY(an3,z)+y4;
    if(GetLen(rx,ry,x3,y3)==R) printf("%.3f %.3f %.3f\n",rx,ry,R);
    else{
      rx=GetAnToX(an2,z)+x4;
      ry=GetAnToY(an2,z)+y4;
      printf("%.3f %.3f %.3f\n",rx,ry,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)));
}

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("%.3f %.3f %.3fn", ans.x, ans.y, getTwoPointDictance( a, ans));
    }
}

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

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 = cen2.real() >= 0 ? 1000*cen2.real()+0.5 : 1000*cen2.real()-0.5;
		int y1000 = cen2.imag() >= 0 ? 1000*cen2.real()+0.5 : 1000*cen2.real()-0.5;
		int r1000 = r2          >= 0 ? 1000*r2         +0.5 : 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 <cstdio>
#include <cmath>
using namespace std;

float a, b, c, d, e, f;
float x, y;
float rx, ry;

void solve(){
  float tmp1 = f-(c*d/a);
  float tmp2 = e-(b*d/a);
  y = tmp1/tmp2;
  x = (c - b * y) / a;
  
  // ツ四ツ偲個古慊禿シ
  int tx = (int)(10000 * x);
  if (tx % 10 >= 5) {
    tx += 10;
  }
  tx /= 10;
  x = (float)tx / 1000.0f;

  int ty = (int)(10000 * y);
  if (ty % 10 >= 5) {
    ty += 10;
  }
  ty /= 10;
  y = (float)ty / 1000.0f;
  
  printf("%.3f %.3f ", x, y);        
}

int main(int argc, char const* argv[]) {
  int n;
  cin>>n;
  for (int i = 0; i < n; i += 1) {
    float x1, y1, x2, y2, x3, y3;
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    a = -2*x1 + 2*x2;
    b = -2*y1 + 2*y2;
    c = x2*x2 + y2*y2 - x1*x1 - y1*y1;
    d = -2*x1 + 2*x3;
    e = -2*y1 + 2*y3;
    f = x3*x3 + y3*y3 - x1*x1 - y1*y1;

    solve();
    
    float r = (x - x1)*(x - x1) + (y - y1)*(y - y1);
    r = sqrt(r);
    int tr = (int)(10000 * r);
    if (tr % 10 >= 5) {
      tr += 10;
    }
    tr /= 10;
    r = (float)tr / 1000.0f;
    
    printf("%.3f\n", r);
  }  
  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, e, f;

	cin >> n;

	for (int i = 0; i < n; i++) {

		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

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

		Y = (a*b + c*d) / (e - f);
		X = (b + 2 * Y*(y1 - y2)) / (-2 * c);
		R = sqrt((X - x1)*(X - x1) + (Y - y1)*(Y - y1));

		//?°???°????¬¬??????????????¨?????\

		if (X > 0)
			X = (int)(X * 1000 + 0.5) ;
		else X = (int)(X * 1000 - 0.5) ;

		if (Y>0)
			Y = (int)(Y * 1000 + 0.5) ;
		else Y = (int)(Y * 1000 - 0.5) ;

		if (R > 0)
			R = (int)(R * 1000 + 0.5);
		else R = (int)(R * 1000 - 0.5);

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

C++: #include <stdio.h>
#include <math.h>
#define sqr(x) ((x) * (x))

int main() {
	double x1, y1, x2, y2, x3, y3;
	double xp, yp, r;
	int n;
	int i;

	scanf("%d", &n);

	for(i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

		xp = ((sqr(x1) - sqr(x2) + sqr(y1) - sqr(y2)) * (y2 - y3) - (sqr(x2) - sqr(x3) + sqr(y2) - sqr(y3)) * (y1 - y2))
				/ (2 * ((x1 - x2) * (y2 - y3) - (x2 - x3) * (y1 - y2)));

		yp = ((sqr(x1) - sqr(x2) + sqr(y1) - sqr(y2)) * (x2 - x3) - (sqr(x2) - sqr(x3) + sqr(y2) - sqr(y3)) * (x1 - x2))
				/ (2 * ((y1 - y2) * (x2 - x3) - (y2 - y3) * (x1 - x2)));

		r = sqrt(sqr(x1 - xp) + sqr(y1 - yp));
	
		printf("%.3lf %.3lf %.3lf\n", xp, yp, r);

	}

	return 0;
}

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

int main(){
	
	int n;
	double x1,y1,x2,y2,x3,y3;
	
	cin>>n;
	while(n>0){
		double px,py,r;
		double A,B,C,a,b,c;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		A=2*(x2-x1);
		B=2*(y2-y1);
		C=(pow(x1,2)-pow(x2,2))+(pow(y1,2)-pow(y2,2));
		a=2*(x3-x1);
		b=2*(y3-y1);
		c=(pow(x1,2)-pow(x3,2))+(pow(y1,2)+pow(y3,2));
		
		px=(B*c-b*C)/(A*b-a*B);
		py=(C*a-c*A)/(A*b-a*B);
		r=sqrt(pow(x1-px,2)+pow(y1-py,2));
				
		printf("%.3f %.3f %.3f\n",px,py,r);
		n--;
		
	}
}