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 <stdio.h>
#include <math.h>

int main(int argc,char* argv[]){
  double x1,y1,x2,y2,x3,y3;
  double x,y,r;
  double r12,r23,r31,angle1,angle2,angle3;
  int num,count;
  
  scanf("%d",&num);
  
  for(count = 0; num > count;count++){
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
    
    r12 = sqrt((x1 -x2)*(x1 -x2) + (y1 -y2)*(y1 -y2));
    r23 = sqrt((x2 -x3)*(x2 -x3) + (y2 -y3)*(y2 -y3));
    r31 = sqrt((x3 -x1)*(x3 -x1) + (y3 -y1)*(y3 -y1));
    
    angle3 = acos( (r23*r23+r31*r31-r12*r12) / (2.0*r23*r31) );
    angle1 = acos( (r31*r31+r12*r12-r23*r23) / (2.0*r31*r12) );
    angle2 = acos( (r12*r12+r23*r23-r31*r31) / (2.0*r12*r23) );
    
    x = (sin(2.0*angle1)*x1 + sin(2.0*angle2)*x2 + sin(2.0*angle3)*x3)/(sin(2.0*angle1) + sin(2.0*angle2) + sin(2.0*angle3));
    y = (sin(2.0*angle1)*y1 + sin(2.0*angle2)*y2 + sin(2.0*angle3)*y3)/(sin(2.0*angle1) + sin(2.0*angle2) + sin(2.0*angle3));
    
    r = r23/ sin(angle1) / 2.0;
    
    printf("%.3lf %.3lf %.3lf\n",x,y,r);
  }
  
  return 0;
  
}

C++: #include<iostream>
#include<math.h>

int main(){
  int n;
  double a,b,c,d,e,f,x,y,r;
  double x1,y1,x2,y2,x3,y3;

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> x1>>y1>>x2>>y2>>x3>>y3;
    a = 2*(x1-x2);
    b = 2*(y1-y2);
    c = +(x1*x1-x2*x2)+(y1*y1-y2*y2);
    d = 2*(x2-x3);
    e = 2*(y2-y3);
    f = +(x2*x2-x3*x3)+(y2*y2-y3*y3);

    x = (double)(c*e-b*f)/(a*e-b*d);
    y = (double)(a*f-c*d)/(a*e-b*d);

    if(x == 0){x = 0;}
    if(y == 0){y = 0;}

    r = sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));

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

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

int n;
double x[3],y[3];
struct data{
	double a,b,c;
	data(double aa,double bb,double cc){
		a=aa;
		b=bb;
		c=cc;
	}
};

struct data2{
	double x,y,r;
	data2(){

	}
	data2(double xx,double yy,double rr){
		x=xx;
		y=yy;
		r=rr;
	}
};

data make_line(int i,int j){
	if(x[i]==x[j]){
		return data(0.0,(y[i]+y[j])/2.0,1);
	}
	if(y[i]==y[j]){
		return data((x[i]+x[j])/2,0,0); 
	}
	double aa=(y[i]-y[j])/(x[i]-x[j]);
	aa=-1.0/aa;
	double bb=(y[i]+y[j])/2.0-(x[j]+x[i])/2.0*aa;
	return data(aa,bb,1);
}

data2 cross(data y1,data y2){
	data2 d;
	if(y1.c==0){
		d.x=y1.a;
		d.y=y2.a*d.x+y2.b;
	}
	if(y2.c==0){
		d.x=y2.a;
		d.y=y1.a*d.x+y1.b;
	}
	if(y1.c==1 && y2.c==1){
		d.x=-(y1.b-y2.b)/(y1.a-y2.a);
		d.y=y1.a*d.x+y1.b;
	}
	d.r=sqrt(pow(d.x-x[0],2)+pow(d.y-y[0],2));
	return d; 
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		data y1=make_line(0,1);
		//printf("%.3f %.3f\n",y1.a,y1.b);
		data y2=make_line(0,2);
		//printf("%.3f %.3f\n",y2.a,y2.b);
		data2 y3=cross(y1,y2);
		printf("%.3f %.3f %.3f\n",y3.x,y3.y,y3.r);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#define PI 3.141592653589793
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x,x2,x3,y,y2,y3,b,c,px,py,z;
		cin>>x>>x2>>x3>>y>>y2>>y3;
		b=sqrt(pow(x3-x2,2)+pow(y3-y2,2));
		c=sqrt(pow(x-x3,2)+pow(y-y3,2));
		z=asin(b/c);
		px=((y3-y)*(x2*x2-x*x+y2*y2-y*y)+(y-y2)*(x3*x3-x*x+y3*y3-y*y))/(2*(x2-x)*(y3-y)-(y2-y)*(x3-x));
		py=((x-x3)*(x2*x2-x*x+y2*y2-y*y)+(x2-x)*(x3*x3-x*x+y3*y3-y*y))/(2*(x2-x)*(y3-y)-(y2-y)*(x3-x));
		printf("%.3lf %.3lf %.3lf\n",px/2,py/2,(b/sin(z))/2);
	}
	return 0;
}

C++: #include <iostream>
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 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 x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
		double y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
		//	http://www.h6.dion.ne.jp/~jpe02_tn/ki-5.html

		double r = sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y));

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

}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


inline double inp(const P &a, const P &b) {
	return (conj(a) * b).real();
}

inline double outp(const P &a, const P &b) {
	return (conj(a) * b).imag();
}

P circumc(const P &a, const P &b, const P &c) {
	return (a + b - (inp(c - b, a - c) / outp(b - a, c - b)) * (b - a) * P(0, 1)) / 2.0;
}

double circumr(const P &A, const P &B, const P &C) {
	double a = abs(B - C), b = abs(A - C), c = abs(B - C);
	double s = (a + b + c) / 2.0;
	double S = sqrt(s * (s - a) * (s - b) * (s - c));
	return a * b * c / 4.0 / S;
}


int main(){
	int n; cin >> n;
	while (n--) {
		double x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		P p1(x1, y1), p2(x2, y2), p3(x3, y3);
		P c = circumc(p1, p2, p3);
		double r = circumr(p1, p2, p3);
		double x = c.real();
		double y = c.imag();
		if (fabs(x + 0.0005) < 0.001) x = 0;
		if (fabs(y + 0.0005) < 0.001) y = 0;
		printf("%.3lf %.3lf %.3lf\n", x, y, r);
	}
	return 0;
}