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<cmath>
#include<algorithm>
using namespace std;
class Point {
public:
	double x, y;
};
double distance(Point x, Point y) {
	return pow(pow(fabs(x.x - y.x), 2) + pow(fabs(x.y - y.y), 2), 0.5);
}
int main() {
	Point p[3],s;
	for (int i = 0; i < 3; i++) {
		cin >> p[i].x >> p[i].y;
	}
	double a, b, c, d, e, f;
	a = (-2)*p[0].x + 2 * p[1].x;
	b = (-2)*p[0].y + 2 * p[1].y;
	c = (-2)*p[0].x + 2 * p[2].x;
	d = (-2)*p[0].y + 2 * p[2].y;
	e = pow(p[0].x, 2) + pow(p[0].y, 2) - pow(p[1].x, 2) - pow(p[1].y, 2);
	f = pow(p[0].x, 2) + pow(p[0].y, 2) - pow(p[2].x, 2) - pow(p[2].y, 2);
	s.x = (b*f - d*e) / (a*d - b*c);
	s.y = (a*f - c*e) / (b*c - a*d);
	cout << s.x << " " << s.y << " " << distance(p[0], s) << endl;
	
	return 0;
}

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

int main()
{
  double eps = 10e-7;
  double x1,y1,x2,y2,x3,y3;
  int T;
  scanf("%d",&T);
  for(int i=0;i<T;i++){
  scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
  double a = pow(x2-x3,2.0)+pow(y2-y3,2.0);
  double b = pow(x3-x1,2.0)+pow(y3-y1,2.0);
  double c = pow(x1-x2,2.0)+pow(y1-y2,2.0);
  double a2 = sqrt(pow(x2-x3,2.0)+pow(y2-y3,2.0));
  double b2 = sqrt(pow(x3-x1,2.0)+pow(y3-y1,2.0));
  double c2 = sqrt(pow(x1-x2,2.0)+pow(y1-y2,2.0));
  double s = (a2+b2+c2)/2.0;
  double S = sqrt(s*(s-a2)*(s-b2)*(s-c2));
  double px = (a*(b+c-a) * x1 + b*(c+a-b) * x2 + c*(a+b-c) * x3) / (16.0*pow(S,2.0));
  double py = (a*(b+c-a) * y1 + b*(c+a-b) * y2 + c*(a+b-c) * y3) / (16.0*pow(S,2.0));
  double r = a2*b2*c2/(4.0*S);
  px += 0.00005 + eps;
  py += 0.00005 + eps;
  r += 0.00005 + eps;
  printf("%.3f %.3f %.3f\n",px,py,r);
  }
}

C++: #include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
double ff(double a,int b){
  b++;
  a*=pow(10.0,b);
  //  cout<<a<<endl;
  int c = a;
  if(c%10>4)c+=10;
  c/=10;
  return (double)c/pow(10.0,b-1);
}



double ax,ay,bx,by,cx,cy,ox,oy,dx,dy,ex,ey;
//ack はACの傾き  eos はEOの切片
double abk,ack,dok,eok,eos,dos;
int n;
int main(){

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>ax>>ay>>bx>>by>>cx>>cy;
    //ABの中点をD,  ACの中点をE 外接円の中心をO とする
    dx=(ax+bx)/2.0;
    dy=(ay+by)/2.0;
    ex=(ax+cx)/2.0;
    ey=(ay+cy)/2.0;
    
    if(ax==bx){
      abk=(ay-by)/0.00000001;
    }else{
      abk=(ay-by)/(ax-bx);
    }
    if(abk==0.0)abk=0.00000001;
    dok=-1.0/abk;
    dos=dy-dx*dok;
    
    
    if(ax==cx){
      ack=(ay-cy)/0.00000001;
    }else{
      ack=(ay-cy)/(ax-cx);
    }
    if(ack==0.0)ack=0.00000001;
    eok=-1.0/ack;
    eos=ey-ex*eok;
    
    //Y  =  dok X  + dos
    //Y  =  eok X  + eos
    //dok X + dos = eok X + eos
    
    double Y,X;
    if(dok-eok==0.0){
      X=(eos-dos)/0.00000001;
    }else{
      X=(eos-dos)/(dok-eok);
    }
    Y= dok * X + dos;
    
    printf("%.3f %.3f ",ff(X,3),ff(Y,3));
    //cout<<ax<<' '<<X<<' '<<ay<<' '<<Y<<endl;
    printf("%.3f\n" ,  ff( sqrt( pow(ax-X,2) + pow(ay-Y,2) )   ,3)   );
    
    
  }
  return 0;
}

C++: #include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
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;
    double x,y,r;
    double a,b,c,d,e,f;
    a=2*x1-2*x2;
    b=2*y1-2*y2;
    c=x1*x1-x2*x2+y1*y1-y2*y2;
    d=2*x2-2*x3;
    e=2*y2-2*y3;
    f=x2*x2-x3*x3+y2*y2-y3*y3;
        x=(b*f-e*c)/(a*e-d*b);
        y=(c*d-f*a)/(a*e-d*b);
        
   r=hypot(x-x1,y-y1);
    
    printf("%.3lf %.3lf %.3lf\n",x,y,r);
}
}

C++: #include <algorithm>
#include <vector>
#include <cstdio>
#include <utility>
#include <complex>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;
static const double PI=3.141592653589793;

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

namespace std {
    bool operator<(const Point &a, const Point &b) {
        return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
    }
}

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

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

struct Line: public pair<Point, Point> {
    Line() {}
    Line(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct LineSeg: public pair<Point, Point> {
    LineSeg() {}
    LineSeg(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct Circle {
    Point p;
    double r;
    Circle() {}
    Circle(const Point &p, const double r): p(p), r(r) {}
};

Point get_ipoint(const Line &l, const Line &m) {
    Point b=m.second-m.first;
    double d1=abs(cross_prod(b, l.first-m.first));
    double d2=abs(cross_prod(b, l.second-m.first));
    return l.first + (d1/(d1+d2))*(l.second-l.first);
}

bool testcase_ends() {
    double x, y;
    if (scanf("%lf %lf", &x, &y) == EOF)
        return 1;

    Point A(x, y);
    scanf("%lf %lf", &x, &y);
    Point B(x, y);
    scanf("%lf %lf", &x, &y);
    Point C(x, y);

    Line l((A+B)/2.0, (A+B)/2.0+(B-A)*polar(1.0, PI/2));
    Line m((B+C)/2.0, (B+C)/2.0+(C-B)*polar(1.0, PI/2));

    Point P=get_ipoint(l, m);
    double r=abs(P-A);
    printf("%.3f %.3f %.3f\n", P.real(), P.imag(), r);

    return 0;
}

int main() {
    size_t n;
    scanf("%zu", &n);

    for (size_t i=0; i<n; ++i)
        if (testcase_ends())
            return 1;

    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] = pow(x[i], 2);
			y2[i] = pow(y[i], 2);
		}
		
		// eÓÌ·³ðßéBO½ûÌèðp
		double a, b, c, a2, b2, c2;
		a2 = abs(pow(x[2]-x[1], 2) + pow(y[2]-y[1], 2));
        b2 = abs(pow(x[0]-x[2], 2) + pow(y[0]-y[2], 2));
        c2 = abs(pow(x[1]-x[0], 2) + pow(y[1]-y[0], 2));
		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(pow(px-x[0], 2)+pow(py-y[0], 2)) << endl;
	}
	
	return 0;
}