Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		cal()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func cal() {
	var x1, y1, x2, y2, x3, y3 float64
	fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)
	a := 2 * (x1 - x2)
	b := 2 * (y1 - y2)
	c := 2 * (x1 - x3)
	d := 2 * (y1 - y3)
	e := x1*x1 - x2*x2 + y1*y1 - y2*y2
	f := x1*x1 - x3*x3 + y1*y1 - y3*y3

	px := (d*e - b*f) / (a*d - b*c)
	py := (a*f - c*e) / (a*d - b*c)

	r := math.Sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py))
	fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
}

C++: #include <iostream>

#include <cstdio>

#include <cmath>

using namespace std;



int main(){

	int n;

	double x1,y1,x2,y2,x3,y3,x1_2,x1_3,y1_2,y1_3,z1_2,z1_3,a,b,c,r;

	while(cin >> n){

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

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

			z1_2 = (((x1 * x1) + (y1 * y1)) * -1) - (((x2 * x2) + (y2 * y2)) * -1);

			z1_3 = (((x1 * x1) + (y1 * y1)) * -1) - (((x3 * x3) + (y3 * y3)) * -1);

			x1_2 = x1 - x2;

			x1_3 = x1 - x3;

			y1_2 = y1 - y2;

			y1_3 = y1 - y3;

			a = ((y1_2 * z1_3) - (y1_3 * z1_2)) / ((y1_2 * x1_3) - (y1_3 * x1_2));

			b = ((x1_2 * z1_3) - (x1_3 * z1_2)) / ((x1_2 * y1_3) - (x1_3 * y1_2));

			c = ((x1 * x1) + (y1 * y1) + (a * x1) + (b * y1)) * -1;

			r = sqrt((c * -1) + (a * a / 4.0) + (b * b / 4.0));

			printf("%.3f %.3f %.3f\n",a / -2.0,b / -2.0,r);

		}

	}

	return 0;

}

C++:  /*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
 */

#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>

using namespace std;

 /*
http://zo3kirin3.net/?p=297
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q104383420
http://www.nn.iij4u.or.jp/~hsat/misc/math/centre/circumcentre.html
 */

int main() {
	int n; cin >> n;
	vector<double> x(3), y(3), x2(3), y2(3);		// x,yªÀWÌXgAx2,y2ªÀWÌñæÌXg
	
	for (int p=0; p<n; p++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
		for (int i=0; i<3; i++) {
			x2[i] = x[i]*x[i];
			y2[i] = y[i]*y[i];
		}
		
		// eÓÌ·³ðßéBO½ûÌèðp
		double a, b, c, a2, b2, c2;
		a2 = abs((x[2]-x[1])*(x[2]-x[1]) + (y[2]-y[1])*(y[2]-y[1]));
        b2 = abs((x[0]-x[2])*(x[0]-x[2]) + (y[0]-y[2])*(y[0]-y[2]));
        c2 = abs((x[1]-x[0])*(x[1]-x[0]) + (y[1]-y[0])*(y[1]-y[0]));
		a = sqrt(a2); b = sqrt(b2); c = sqrt(c2);
		
		// ÊÏBwÌö®ðpB
		double s, S2;
		s = (a+b+c) / 2;
		S2 = s*(s-a)*(s-b)*(s-c);
		
		// OSðßéBö®ÍWeby[WðQÆ©xNgâÁÄÈ¢©çà¾Å«È¢c
		double px, py;
		px = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
        py = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
        
        // oÍB®`µÄoÍ·éB¼aÍ¼üÌûö®ÅB
        cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0])) << endl;
	}
	
	return 0;
}

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

using namespace std;

float round(float val){return ((int)(val*1000+0.5)/1000.0);}

int main(void){
	int n;
	float x[3],y[3],a,b,c,d,X,Y,px,py;

	cin >> n;
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++)
			cin >> x[j] >> y[j];

		a=x[0]-x[1];
		b=y[0]-y[1];
		c=x[0]-x[2];
		d=y[0]-y[2];
		X=pow(x[0],2)-pow(x[1],2)+pow(y[0],2)-pow(y[1],2);
		Y=pow(x[1],2)-pow(x[2],2)+pow(y[0],2)-pow(y[2],2);
		px=(d*X-b*Y)/(a*d-b*c)/2;
		py=(-c*X+a*Y)/(a*d-b*c)/2;

		printf("%.3f %.3f %.3f\n",round(px),round(py),round(sqrt(pow(x[0]-px,2)+pow(y[0]-py,2))));
	}
	return 0;
}

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


int main(void){

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

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

      double a = sqrt(pow(x2-x1,2) + pow(y2-y1,2));
      double b = sqrt(pow(x3-x2,2) + pow(y3-y2,2));
      double c = sqrt(pow(x3-x1,2) + pow(y3-y1,2));

      double r = a*b*c / sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));

      double A = pow(x2-x1,2) + pow(y2-y1,2);
      double B = pow(x3-x2,2) + pow(y3-y2,2);
      double C = pow(x3-x1,2) + pow(y3-y1,2);
      double s = (A*(B+C-A) + B*(C+A-B) + C*(A+B-C));


      double x = 2*A*(B+C-A) / s;
      double y = 2*B*(C+A-B) / s;
      if(x == 0){
        x = 0;
      }
      if(y == 0){
        y=0;
      }

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

    }
  }




  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <cassert>
using namespace std;
typedef pair<double, double> PDD;
PDD calc(double mat[2][2], double vec[2]){
  double a = mat[0][0], b = mat[0][1], d = mat[1][0], e = mat[1][1];
  double c = vec[0], f = vec[1];
  double det = a * e - d * b;
  return make_pair((e * c - b * f) / det, (-c * d + a * f) / det);
}
int main(){
  int Tc;
  cin >> Tc;
  for(int tc = 0; tc < Tc; ++tc){
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    if(y1 - y3 == 0){
      swap(y2, y3);
      swap(x2, x3);
    }
    else if(y2 - y3 == 0){
      swap(y1, y3);
      swap(x1, x3);
    }
    double A, B, C, D, E, F;
    A = (y1 + y3) / 2.;
    B = (x1 - x3) / (y1 - y3);    
    C = (x1 + x3) / 2.;
    D = (y2 + y3) / 2.;
    E = (x2 - x3) / (y2 - y3);
    F = (x2 + x3) / 2.;
    double mat[2][2];
    mat[0][0] = B; mat[0][1] = 1;
    mat[1][0] = E; mat[1][1] = 1;
    double vec[2];
    vec[0] = A + B * C;
    vec[1] = D + E * F;
    PDD res = calc(mat, vec);
    double x = res.first, y = res.second;
    assert(x==x); assert(y==y);
    double r = pow((x-x1)*(x-x1)+(y-y1)*(y-y1), 0.5);
    x = (double)(round(x*1000))/1000.0;
    y = (double)(round(y*1000))/1000.0;
    r = (double)(round(r*1000))/1000.0;    
    x = (x == -0.0) ? 0.0 : x;
    y = (y == -0.0) ? 0.0 : y;
    printf("%.3f %.3f %.3f\n", x, y, r);
  }
  return 0;
}

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

using namespace std;

int n;
double x[4],y[4],r;

int main(){
	cin >> n;
	while(n--){
		for(int i=0;i<3;i++){
			cin >> x[i] >> y[i];
		}
		x[3]=((y[2]-y[1])*(x[1]-x[0])*(x[2]-x[0])-(y[1]-y[0])*(x[1]+x[0])*(x[2]-x[0])+(y[2]-y[0])*(x[1]-x[0])*(x[2]+x[0]))/(2*(y[2]-y[0])*(x[1]-x[0])-(y[1]-y[0])*(x[2]-x[0]));
		y[3]=(y[0]+y[1])/2-(y[1]-y[0])*(x[3]-(x[0]+x[1])/2)/(x[1]-x[0]);
		printf("%.3lf %.3lf\n",x[3],y[3]);
	}
	return 0;
}