Go: package main

import (
	"fmt"
	"math"
)

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

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

func circleTriangle() {
	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<stdio.h>
#include<math.h>
using namespace std;
 struct vect{
    double x,y;
 };
int main(){
  vect a,b,c,p,l1,l2,M1,M2;
  double t1,r;
  int n;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
    M1.x = (a.x + b.x) /2;
    M1.y = (a.y + b.y) /2;
    M2.x = (b.x + c.x)/2;
    M2.y = (b.y + c.y)/2;
    l1.y = -(b.x - a.x);
    l1.x = b.y -a.y;
    l2.y = -(c.x-b.x);
    l2.x = c.y -b.y;
    t1 = 1/(-l1.x * l2.y + l2.x * l1.y) *( -l2.y * (M2.x -M1.x) + l2.x * (M2.y -M1.y));
    p.x = M1.x + l1.x * t1;
    p.y = M1.y + l1.y * t1;
    r = sqrt((p.x - a.x)*(p.x - a.x) +(p.y - a.y)*(p.x -a.y));
    printf("%.3f %.3f %.3f\n",p.x,p.y,r);
  }
}

C++: #include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(){
	int cnt;
	cin >> cnt;
	double x1, y1, x2, y2, x3, y3;
	double a1, a2, b1, b2, c1, c2;
	double a, b, c;
	double A;
	double xp, yp, r;
	while (cnt > 0 && cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
		// ?????\??????????????§?¨?????±???????
		a1 = 2 * (x2 - x1);
		b1 = 2 * (y2 - y1);
		c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
		a2 = 2 * (x3 - x1);
		b2 = 2 * (y3 - y1);
		c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		xp = (double)((b1*c2 - b2*c1) / (a1*b2 - a2*b1) * 1000) / 1000.0;
		yp = (double)((c1*a2 - c2*a1) / (a1*b2 - a2*b1) * 1000) / 1000.0;

		// ?????\????????????????±???????
		r = hypot(xp - x1, yp - y1);

		cout << fixed << setprecision(3);
		cout << xp << " " << yp << " " << r << endl;
		cnt -= 1;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
  double x1, y1, x2, y2, x3, y3;
  double px, py;
  double r;
  double M1, mx1, my1;
  double M2, mx2, my2;
  int n;
  cin >> n;

  while(1){
    if(n == 0) break;

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

    mx1 = (x1 + x2) / 2;
    my1 = (y1 + y2) / 2;
    if(y1 - y2 == 0) M1 = 0;
    else  M1 = (-1)*(x1 - x2) / (y1 - y2);
   

    mx2 = (x2 + x3) / 2;
    my2 = (y2 + y3) / 2;
    if(y2 - y3 == 0) M2 = 0;
    else  M2 = (-1)*(x2 - x3) / (y2 -y3);
    

    if(M1 == M2){
      px = mx1;
      py = my2;
    }
    else if(M1 != M2){
      px = (M1*mx1 - my1 - M2*mx2 + my2) / (M1 - M2);
      py = M1*(px - mx1) + my1;
    }

    r = sqrt((x1 - px)*(x1 - px) + (y1 - py)*(y1 - py));

    printf("%.3f %.3f %.3f\n",px,py,r);
    n--;
  }
 return 0; 
}

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

int w(int n)
{
  return n * n;
}

int main()
{
  double x1, y1, x2, y2, x3, y3;
  int n;
  double a, b, c;
  double px, py, r;

  cin >> n;

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

    a = sqrt(w(x1 - x2) + w(y1 - y2));
    b = sqrt(w(x2 - x3) + w(y2 - y3));
    c = sqrt(w(x3 - x1) + w(y3 - y1));
    px = ((y1 - y3) * (w(y1) - w(y2) + w(x1) - w(x2)) - (y1 - y2) * (w(y1) - w(y3) + w(x1) - w(x3))) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3));
    py = ((x1 - x3) * (w(x1) - w(x2) + w(y1) - w(y2)) - (x1 - x2) * (w(x1) - w(x3) + w(y1) - w(y3))) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3));
    //r = (a * b * c) / sqrt((a + b + c) * (b + c - a) * (a - b + c) * (a + b - c));
    x = ((a*a)-((b*b)+(c*c)))/(-2*b*c);
    y = sqrt(1-x*x);
    r = a/(2*y);
    printf("%.3f %.3f %.3f\n", px, py, r);
  }

  return 0;
}

C++: #include <iostream>
 #include <math.h>
 #include <string>
using namespace std;

int main() {
	int n;
	cin>>n;
	for(int h=0;h<n;h++){
double x1,y1,x2,y2,x3,y3,x2m,x3m,y2m,y3m,x21,y21,x31,y31,xy21,xans,yans;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
	x2m=(x1+x2)/2;
	y2m=(y1+y2)/2;
	x3m=(x1+x3)/2;
	y3m=(y1+y3)/2;
	x21=x2-x1;
	x31=x3-x1;
	y21=y2-y1;
	y31=y3-y1;
	
	
if(y1!=y2){
	xy21=x21/y21;
	xans=(x31*x3m-y31*(xy21*x2m+y3m-y2m))/(x31-y31*xy21);
	yans=-xy21*(xans-x2m)+y2m;
}	
else{
	xans=x2m;
	yans=(x3m-xans)*x31/y31+y3m;
}
double r;
r=sqrt((xans-x1)*(xans-x1)+(yans-y1)*(yans-y1));
double x=xans,y=yans;
	printf("%.3f %.3f %.3f\n",xans,yans,r);
}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

struct Coor{
	double x,y;
};

struct Ans2{
	double l,m;
};

struct Ans3{
	double l,m,n;
	Ans3(Ans2 a){
		l=a.l; m=a.m;
	}
};

Ans2 solve2(double l[2],double m[2],double n[2]){
	/*for(int i=0;i<2;i++){
		printf("(%lfl)+(%lfm)+n = (%lf)\n",l[i],m[i],n[i]);
	}*/
	Ans2 ans;
	double a,b;
	a = l[0]*m[1]-l[1]*m[0]; b = n[0]*m[1]-n[1]*m[0];
	ans.l = b/a;
	//printf("%lfx = %lf\n",a,b);
	a = m[0]*l[1]-m[1]*l[0]; b = n[0]*l[1]-n[1]*l[0];
	ans.m = b/a;
	//printf("%lfy = %lf\n",a,b);
	return ans;
}

Ans3 solve3(double l[3],double m[3],double n[3]){
	double _l[2],_m[2],_n[2];
	_l[0] = l[0]-l[1]; _l[1] = l[0]-l[2];
	_m[0] = m[0]-m[1]; _m[1] = m[0]-m[2];
	_n[0] = n[0]-n[1]; _n[1] = n[0]-n[2];
	Ans3 ans = Ans3(solve2(_l,_m,_n));
	ans.n = n[0]-(l[0]*ans.l+m[0]*ans.m);
	return ans;
}

int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		Coor in[3];
		double l[3],m[3],n[3];
		for(int i=0;i<3;i++){
			cin>>in[i].x>>in[i].y;
			l[i] = in[i].x;
			m[i] = in[i].y;
			n[i] = -(in[i].x*in[i].x+in[i].y*in[i].y);
			//printf("(%lfl)+(%lfm)+n = (%lf)\n",l[i],m[i],n[i]);
		}
		Ans3 ans3 = solve3(l,m,n);
		//printf("l = %lf, m = %lf, n = %lf\n",ans3.l,ans3.m,ans3.n);
		double r = sqrt(-(ans3.n-ans3.l/2*ans3.l/2-ans3.m/2*ans3.m/2));
		printf("%.3lf %.3lf %.3lf\n",-ans3.l/2,-ans3.m/2,r);
	}
}