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 <cstdio>
using namespace std;

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3;

	while(cin >> n >> x1 >> y1 >> x2 >> y2 >> x3 >> y3){
		if(y1-y2==0.0 && y1-y2==0.0){
			swap(x1, x2);
			swap(y1, y2);
		}
		if(y1-y2==0.0 && y1-y2==0.0){
			swap(x1, x3);
			swap(y1, y3);
		}

		double a12, b12, a13, b13;
		a12 = -(x1-x2)/(y1-y2);
		a13 = -(x1-x3)/(y1-y3);

		double x12, y12, x13, y13;
		x12 = (x1+x2)/2.0;
		y12 = (y1+y2)/2.0;
		x13 = (x1+x3)/2.0;
		y13 = (y1+y3)/2.0;

		b12 = y12 - a12 * x12;
		b13 = y13 - a13 * x13;

		double xp, yp;
		xp = -(b12-b13)/(a12-a13);
		yp = a12*xp + b12;

		double r;
		r = sqrt(pow((x1-x12),2.0) + pow((y1-y12),2.0));

		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}


	return(0);
}

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

int main(){
    int n;
    double x1, x2, x3, y1, y2, y3, x, y;
    cin >> n;
    for(int i = 0;i < n;i++){
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	if(y1 == y2)swap(x1, x3), swap(y1, y3);
	else if(y1 == y3)swap(x1, x2), swap(y1, y2);
	double x = (x3-x1)/(y1-y3)*(x1+x3)/2-(x2-x1)/(y1-y2)*(x1+x2)/2+(y1+y2)/2-(y1+y3)/2;
	x /= ((x3-x1)/(y1-y3) - (x2-x1)/(y1-y2));
	double y = (x2-x1)/(y1-y2)*(x - (x1+x2)/2) + (y1+y2)/2;
	printf("%.3lf %.3lf %.3lf\n", x, y, hypot(x1-x,y1-y));
    }
    return 0;
}

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

using namespace std;

int main() {
	int c;
	double x1, y1, x2, y2, x3, y3;
	double px, py, r;
	double e1, e2, e3;
	double l, m, n;

	cout << fixed << setprecision(3);
	cin >> c;
	for (int i = 0; i < c; ++i) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		e1 = - pow(x1, 2) - pow(y1, 2);
		e2 = - pow(x2, 2) - pow(y2, 2);
		e3 = - pow(x3, 2) - pow(y3, 2);

		l = (e1 * y2+ e2 * y3+ e3 * y1- e1 * y3- e2 * y1- e3 * y2)/ (x1 * y2+ x2 * y3+ x3 * y1- x1 * y3- x2 * y1- x3 * y2);
		m = (x1 * e2+ x2 * e3+ x3 * e1- x1 * e3- x2 * e1- x3 * e2)/ (x1 * y2+ x2 * y3+ x3 * y1- x1 * y3- x2 * y1- x3 * y2);
		n = (x1 * y2 * e3 + x2 * y3 * e1 - x3 * y1 * e2 - x1 * y3 * e2 - x2 * y1 * e3 - x3 * y2 * e1)/ (x1 * y2+ x2 * y3+ x3 * y1- x1 * y3- x2 * y1- x3 * y2);

		px = - l / 2;
		py = - m / 2;
		r = sqrt(pow(px, 2) + pow(py, 2) - n);

		if (px == -0) px = 0;
		if (py == -0) py = 0;
		if (r == -0) r = 0;

		cout << px << " " << py << " " << r << endl;
	}

	return 0;
}

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 <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n;
    double a, b, c, d, e, f;
    double x1, x2, x3, y1, y2, y3, px, py, r;
    cin >> n;
    while (n--) {
        cin >> x1 >> x2 >> x3 >> y1 >> y2 >> y3;
        a = 2 * (x1 - x2);
        b = 2 * (y1 - y2);
        c = x1*x1 + y1*y1 - x2*x2 - y2*y2;
        d = 2 * (x1 - x3);
        e = 2 * (y1 - y3);
        f = x1*x1 + y1*y1 - x3*x3 - y3*y3;
        px = (c*e - b*f) / (a*e - b*d);
        py = (c*d - a*f) / (b*d - a*e);
        r = sqrt(pow(px - x1, 2) + pow(py - y1, 2));
        printf("%.3f %.3f %.3f\n", px, py, r);
    }
    
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
using namespace std;


int main(){

  int n;
  cin >> n;
  double x[3];

  double y[3];

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

    double a, b, c;
    double r, px, py;

    a = sqrt( (x[0]-x[1])*(x[0]-x[1]) + (y[0]-y[1])*(y[0]-y[1]) );
    b = sqrt( (x[1]-x[2])*(x[1]-x[2]) + (y[1]-y[2])*(y[1]-y[2]) );
    c = sqrt( (x[2]-x[0])*(x[2]-x[0]) + (y[2]-y[0])*(y[2]-y[0]) );

    r = (a*b*c) / (sqrt((a+b+c)*(b+c-a)*(a-b+c)*(a+b-c)));
    px = (((x[0]*x[0])+(y[0]*y[0]))*(y[1]-y[2])+((x[1]*x[1])+(y[1]*y[1]))*(y[2]-y[0])
    +((x[2]*x[2])+(y[2]*y[2]))*(y[0]-y[1]))/(x[0]*(y[1]-y[2])+x[1]*(y[2]-y[0])+x[2]*(y[0]-y[1]))/2;

    py = (((x[0]*x[0])+(y[0]*y[0]))*(x[1]-x[2])+((x[1]*x[1])+(y[1]*y[1]))*(x[2]-x[0])
    +((x[2]*x[2])+(y[2]*y[2]))*(x[0]-x[1]))/(y[0]*(x[1]-x[2])+y[1]*(x[2]-x[0])+y[2]*(x[0]-x[1]))/2;


    printf("%.3lf %.3lf %.3lf\n", px, py, r);
  }




  return 0;
}














// EOF

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

typedef complex<double> P;

inline double dot(P a, P b) {return real( conj(a)*b);}
inline double cross(P a, P b) {return imag( conj(a)*b);}

P IntersectionLL(P a1, P a2, P b1, P b2) {
  P a = a2 - a1; P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}

int main() {
  int T; cin >> T;
  while( T--> 0 ) {
    P p[3];
    for(int i = 0; i < 3; i++) {
      double x, y; cin >> x >> y;
      p[i] = P(x, y);
    }

    P a = p[1] - p[0];
    P b = p[2] - p[0];

    P m1 = p[0] + a / 2.0;
    P m2 = p[0] + b / 2.0;

    P o = IntersectionLL( m1, m1 + a * P(0, 1), m2, m2 + b * P(0, 1) );

    printf("%.3f %.3f %.3f\n", o.real(), o.imag(), abs(o - p[0]) );
  }
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>


#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


double A[2][2];
double C[2];


int main()
{
	int n;
	cin >> n;
	REP(i, n){
		double x1, x2, x3, y1, y2, y3;
		cin >> x1>> x2 >> x3 >> y1 >> y2 >> y3;

		double x21 = x2 - x1;
		double x31 = x3 - x1;
		double y21 = y2 - y1;
		double y31 = y3 - y1;

		double xc = ((y31*(x21*x21 + y21*y21)) - (y21*(x31*x31 + y31*y31))) /
			(2 * (x21*y31 - y21*x31));

		double yc = ((x21*(x31*x31 + y31*y31)) - (x31*(x21*x21 + y21*y21))) /
			(2 * (x21*y31 - y21*x31));	
		
		double d = (xc - x1)*(xc - x1) + (yc - y1)*(yc - y1);
		double xc_ = xc * 10000;
		double yc_ = yc * 10000;
		xc_ += ((int)xc_ % 10) > 4 ? 10 : (int)-xc_%10;
		yc_ += ((int)yc_ % 10) > 4 ? 10 : (int)-yc_%10;

		printf("%.3lf %.3lf %.3lf\n", xc_/10000, yc_/10000, sqrt(d));


	}

}