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>

using namespace std;

int n;
double tx1, ty1, tx2, ty2, tx3, ty3;

int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> tx1 >> ty1;
		cin >> tx2 >> ty2;
		cin >> tx3 >> ty3;

		double mx1 = (tx1 + tx2) / 2.0;
		double my1 = (ty1 + ty2) / 2.0;
		double a1 = (double)(tx2 - tx1);
		double b1 = (double)(ty2 - ty1);
		double c1 = a1 * mx1 + b1 * my1;

		double mx2 = (tx2 + tx3) / 2.0;
		double my2 = (ty2 + ty3) / 2.0;
		double a2 = (double)(tx3 - tx2);
		double b2 = (double)(ty3 - ty2);
		double c2 = a2 * mx2 + b2 * my2;

		if(c1 == 0 && c2 == 0)
		{
			printf("%.3f %.3f %.3f\n", (double)tx1, (double)ty1, 0.0);
			continue;
		}

		double det = a1 * b2 - a2 * b1;
		if(det == 0)
		{
			printf("can not solve\n");
			continue;
		}
		
		double cx = (b2 * c1 - a2 * c2) / det;
		double cy = (-a2 * c1 + a1 * c2) / det;
		
		double dx = cx - tx1;
		double dy = cy - ty1;
		double r = sqrt(dx*dx + dy*dy);
		
		printf("%.3f %.3f %.3f\n", cx, cy, r);
	}
}

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

float round(float val, int d) {
	return (int)(val * pow(10, d) + 0.5) / pow(10,d);
}

int main () {
	int n;
	float x1, x2, x3, y1, y2, y3;
	float m1, m2, b1, b2;
	float x, y, r, hx, hy;
	scanf("%d", &n);
	while (n--) {
		scanf("%f %f %f %f %f %f" , &x1, &y1, &x2, &y2, &x3, &y3);
		if (y1 == y2) {
			x = (x1 + x2) / 2.0;
			m2 = (y3 == y1) ? 0 : 1 / ((y3 - y1) / (x3 - x1));
			hx = (x1 + x3) / 2.0;
			hy = (y1 + y3) / 2.0;
			b2 = m2 * hx + hy;
			y = -m2 * x + b2;
		} else if (y1 == y3) {
			x = (x1 + x3) / 2.0;
			m1 = (y2 == y1) ? 0 : 1 / ((y2 - y1) / (x2 - x1));
			hx = (x1 + x2) / 2.0;
			hy = (y1 + y2) / 2.0;
			b1 = m1 * hx + hy;
			y = -m1 * x + b1;
		} else {
			m1 = (x2 == x1) ? 0 : 1 / ((y2 - y1) / (x2 - x1));
			m2 = (x3 == x1) ? 0 : 1 / ((y3 - y1) / (x3 - x1));
			hx = (x1 + x2) / 2.0;
			hy = (y1 + y2) / 2.0;
			b1 = m1 * hx + hy;
			hx = (x1 + x3) / 2.0;
			hy = (y1 + y3) / 2.0;
			b2 = m2 * hx + hy;
			x = (b1 - b2) / (m1 - m2);
			y = -m1 * x + b1;
		}
		x = round(x, 3);
		y = round(y, 3);
		r = round(sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)), 3);
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

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

using namespace std;

int main(){
	int n;

	cin >> n;

	double* x1 = new double[ n ];
	double* y1 = new double[ n ];
	double* x2 = new double[ n ];
	double* y2 = new double[ n ];
	double* x3 = new double[ n ];
	double* y3 = new double[ n ];

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

	for ( int i = 0; i < n; ++i ){
		double x12, y12, b12, x23, y23, b23, ox, oy, r;
		x12 = x2[ i ] - x1[ i ];
		y12 = y2[ i ] - y1[ i ];
		b12 = x12 * ( x1[ i ] + x2[ i ] ) / 2.0 + y12 * ( y1[ i ] + y2[ i ] ) / 2.0;
		x23 = x3[ i ] - x2[ i ];
		y23 = y3[ i ] - y2[ i ];
		b23 = x23 * ( x2[ i ] + x3[ i ] ) / 2.0 + y23 * ( y2[ i ] + y3[ i ] ) / 2.0;
		oy = ( x12 * b23 - x23 * b12 ) / ( x12 * y23 - x23 * y12 );
		if ( x12 ){
			ox = ( b12 - y12 * oy ) / x12;
		}else{
			ox = ( b23 - y23 * oy ) / x23;
		}
		r = sqrt( pow( ox - x1[ i ], 2.0 ) + pow( oy - y1[ i ], 2.0 ) );

		cout << showpoint << setprecision( 3 ) << setiosflags( ios::fixed )
			 << ( ox == -0.0 ? 0.0 : ox ) << " "
			 << ( oy == -0.0 ? 0.0 : oy ) << " "
			 << r << endl;
	}

	delete[] x1, y1, x2, y2, x3, y3;
	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;

	cin >> n;

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

		a = x2 - x1;
		b = x3 - x1;
		c = y2 - y1;
		d = y3 - y1;
	
		X = 0.5*(a*a*d - b*b*c) / (a*d - b*c) + (c*d*(d - c) / 2);
		Y = -b*(X - b / 2) / d + d / 2;
		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 = -R;
		R = (int)(R * 1000 + 0.5);

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

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
    int a;
    cin >> a;
    while(a--){
        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);
        double r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
}

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

using namespace std;

int main(){
  double x1,y1,x2,y2,x3,y3;
  vector<double> x1l,y1l,x2l,y2l,x3l,y3l;
  int n;

  cin >> n;

  for(int i=0; i<n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    x1l.push_back(x1);
    y1l.push_back(y1);
    x2l.push_back(x2);
    y2l.push_back(y2);
    x3l.push_back(x3);
    y3l.push_back(y3);
  }

  double ex,ey,fx,fy;
  double a,b,c,d,e,f,r;

  for(int i=0; i<n; i++){
    x1=x1l[i];
    y1=y1l[i];
    x2=x2l[i];
    y2=y2l[i];
    x3=x3l[i];
    y3=y3l[i];

    a = x1*x1+y1+y1;
    b = x2*x2+y2+y2;
    c = x3*x3+y3+y3; 
    d = 0.5/(x1*y2-x2*y1+x2*y3-x3*y2+x3*y1-x1*y3);
    e = d*(a*y2-b*y1+b*y3-c*y2+c*y1-a*y3);
    f = d*(x1*b-x2*a+x2*c-x3*b+x3*a-x1*c);
    r = sqrt((e-x1)*(e-x1)+(f-y1)*(f-y1));
    printf("%0.3f %0.3f %0.3f\n",e,f,r);
  }

  return 0;
}

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

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3, m1, m2, m3, b1, b2, b3, px, py, r;
	double d[2], e[2], f[2];
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		d[0] = (x2 + x3) / 2;
		d[1] = (y2 + y3) / 2;
		e[0] = (x3 + x1) / 2;
		e[1] = (y3 + y1) / 2;
		f[0] = (x1 + x2) / 2;
		f[1] = (y1 + y2) / 2;
		m1 = (y3 - y2) / (x3 - x2);
		m2 = (y1 - y3) / (x1 - x3);
		m3 = (y2 - y1) / (x2 - x1);
		b1 = d[1] + d[0] / m1;
		b2 = e[1] + e[0] / m2;
		b3 = f[1] + f[0] / m3;
		px = -(b1 - b2) / ((1 / m2) - (1 / m1));
		py = -(1 / m1) * px + b1;
		r = (double)sqrt((x1 - px) * (x1 - px) + (y1 - py) * (y1 - py));
		px = floor(1000 * (px + 0.0005)) / 1000;
		py = floor(1000 * (py + 0.0005)) / 1000;
		r = floor(1000 * (r + 0.0005)) / 1000;
		cout << fixed << setprecision(3) << px << " " <<  py << " " << r << endl;
	}
	return 0;
}