Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

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

using namespace std;

    // 半径取得の処理
double getR(double x1, double y1, double x2, double y2, double x3, double y3) {
    
    double marginX1, marginX2, marginX3;
    double marginY1, marginY2, marginY3;
    double a, b, c;
    double r, s;
    
        // それぞれのxとyの長さを求める
    marginX1 = abs(x2 - x1);
    marginY1 = abs(y2 - y1);
    marginX2 = abs(x1 - x3);
    marginY2 = abs(y1 - y3);
    marginX3 = abs(x3 - x2);
    marginY3 = abs(y3 - y2);
    
        // それぞれの辺の長さを求める
    a = sqrt(pow(marginX1,2) + pow(marginY1,2));
    b = sqrt(pow(marginX2,2) + pow(marginY2,2));
    c = sqrt(pow(marginX3,2) + pow(marginY3,2));
    
        // 半径を求める
    s = (a + b + c) / 2;
    r = (a * b * c) / (4 * sqrt(s * (s - a) * (s - b) * (s - c)));
    
    /*
    r *= 10000;
    r = (int)r;
    r /= 10;
    r = round(r);
    r /= 1000;
    */
    
    return r;
}

    // 中心座標を求める処理
void getCentralCoodinate(double x1, double y1, double x2, double y2, double x3, double y3, double *xp, double *yp) {
    
    double marginX1, marginX2;
    double marginY1, marginY2;
    double marginXp1, marginXp2;
    double marginYp1, marginYp2;
    double n, m;
    
        // 初期化
    *xp = 0;
    *yp = 0;
    
        // それぞれのxとyの長さを求める
    marginX1 = abs(x2 - x1);
    marginY1 = abs(y2 - y1);
    marginX2 = abs(x1 - x3);
    marginY2 = abs(y1 - y3);
    
        // 中心座標を求めるのに必要な式
    marginXp1 = 2 * marginX1;
    marginYp1 = 2 * marginY1;
    marginXp2 = 2 * marginX2;
    marginYp2 = 2 * marginY2;
    
    n = pow(x1,2) - pow(x2,2) + pow(y1,2) - pow(y2,2);
    m = pow(x1,2) - pow(x3,2) + pow(y1,2) - pow(y3,2);
    
    *xp = (marginYp1 * m - marginYp2 * n) / (marginXp1 * marginYp2 - marginXp2 * marginYp1);
    *yp = (marginXp2 * n - marginXp1 * m) / (marginXp1 * marginYp2 - marginXp2 * marginYp1);
    
    /*
    *xp *= 10000;
    *xp = (int)*xp;
    *xp /= 10;
    *xp = round(*xp);
    *xp /= 1000;
    
    *yp *= 10000;
    *yp = (int)*yp;
    *yp /= 10;
    *yp = round(*yp);
    *yp /= 1000;
    */
}

    // main処理
int main(void) {
    double x1, x2, x3;
    double y1, y2, y3;
    double xp, yp;
    double r;
    int n;
    
    cin >> n;
    
    while(n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        
            // 半径と中心座標を取得する処理
        r = getR(x1, y1, x2, y2, x3, y3);
        getCentralCoodinate(x1, y1, x2, y2, x3, y3, &xp, &yp);
        
            // 出力
        cout << setprecision(3);
        cout << setiosflags(ios::fixed);
        cout << xp << " " << yp << " " << r << endl;
    }
    
    return 0;
}

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

int main(void){
	int n , i;
	float x1,x2,x3,y1,y2,y3,a1,a2,b1,b2,c1,c2,xp,yp,r;
	scanf("%d" , &n);
	for(i=1;i<=n;i++){
		scanf("%f %f %f %f %f %f" , &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 - y1);
		b2 = 2 * (y3 - y1);
		c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		xp = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
		yp = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
		r = sqrt((xp - x1) * (xp - x1) + (yp - y1) * (yp - y1));
		printf("%.3f %.3f %.3f\n" , xp , yp , r);
	}
	return 0;
}

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

struct TCoordinate
{
	double x;
	double y;
};

TCoordinate GetCenterPoint(TCoordinate P1, TCoordinate P2, TCoordinate P3)
{
	double x1 = P1.x;
	double x2 = P2.x;
	double x3 = P3.x;
	double y1 = P1.y;
	double y2 = P2.y;
	double y3 = P3.y;
	double x, y, r;
	if(y1 == y2 || y2 == y3 || y3 == y1){
		if(y2 == y3){
			swap(x3, x1);
			swap(y3, y1);
		}else if(y3 == y1){
			swap(x2, x3);
			swap(y2, y3);
		}
		double xa = (x2 + x3) / 2;
		double ya = (y2 + y3) / 2;
		double a  = (-x3 + x2) / (y3 - y2);
		x = (x1 + x2) / 2;
		y = a * (x - xa) + ya;
	}else{
		double xa = (x1 + x2) / 2;
		double ya = (y1 + y2) / 2;
		double a  = (-x2 + x1) / (y2 - y1);
		double xb = (x2 + x3) / 2;
		double yb = (y2 + y3) / 2;
		double b  = (-x3 + x2) / (y3 - y2);
		x = (b * xb - a * xa - yb + ya) / (b - a);
		y = a * (x - xa) + ya;
	}
	return {x, y};
}

double GetRadius(TCoordinate P1, TCoordinate P2, TCoordinate P3)
{
	double x1 = P1.x;
	double x2 = P2.x;
	double x3 = P3.x;
	double y1 = P1.y;
	double y2 = P2.y;
	double y3 = P3.y;
	double x, y, r;
	if(y1 == y2 || y2 == y3 || y3 == y1){
		if(y2 == y3){
			swap(x3, x1);
			swap(y3, y1);
		}else if(y3 == y1){
			swap(x2, x3);
			swap(y2, y3);
		}
		double xa = (x2 + x3) / 2;
		double ya = (y2 + y3) / 2;
		double a  = (-x3 + x2) / (y3 - y2);
		x = (x1 + x2) / 2;
		y = a * (x - xa) + ya;
	}else{
		double xa = (x1 + x2) / 2;
		double ya = (y1 + y2) / 2;
		double a  = (-x2 + x1) / (y2 - y1);
		double xb = (x2 + x3) / 2;
		double yb = (y2 + y3) / 2;
		double b  = (-x3 + x2) / (y3 - y2);
		x = (b * xb - a * xa - yb + ya) / (b - a);
		y = a * (x - xa) + ya;
	}
	return sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		TCoordinate P1, P2, P3;
		cin >> P1.x >> P1.y >> P2.x >> P2.y >> P3.x >> P3.y;
		TCoordinate CenterPoint = GetCenterPoint(P1, P2, P3);
		double Radius = GetRadius(P1, P2, P3);
		cout << fixed << setprecision(3);
		cout << CenterPoint.x << ' ' << CenterPoint.y << ' ' << Radius << endl;
	}
	return 0;
}

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

using namespace std;

int main(void){
	int n, i, j;
	double x1,y1,x2,y2,x3,y3, r, px, py;
	scanf("%d",&n);
	for(i = 0;i < n;i++){
		scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
		if((y2 - y1) * (x3 - x1) - (y3 - y1) * (x2 - x1) == 0){
			if(x1 == x2 && x2 == x3){
				px = x1;
				py = (max(y1,max(y2,y3)) + min(y1,min(y2,y3))) / 2;
				r = fabs(max(y1,max(y2,y3)) - py);
			}
			else{
				double tx1, ty1, tx2, ty2;
				if(x1 > x2 && x1 > x3){
					tx1 = x1, ty1 = y1;
				}else if(x2 > x1 && x2 > x3){
					tx1 = x2, ty1 = y2;
				}else{
					tx1 = x3, ty1 = y3;
				}
				if(x1 < x2 && x1 < x3){
					tx2 = x1, ty2 = y1;
				}else if(x2 < x1 && x2 < x3){
					tx2 = x2, ty2 = y2;
				}else{
					tx2 = x3, ty2 = y3;
				}
				px = (tx1 + tx2) / 2;
				py = (ty1 + ty2) / 2;
				r = sqrt(pow(tx1 - px,2.0) + pow(ty1 - py,2.0));
			}
		}else{
			py = ((x3 - x1) * (pow(x2,2.0) - pow(x1,2.0) + pow(y2,2.0) - pow(y1,2.0)) - (x2 - x1) * (pow(x3,2.0) - pow(x1,2.0) + pow(y3,2.0) - pow(y1,2.0))) / (2 * ((y2 - y1) * (x3 - x1) - (y3 - y1) * (x2 - x1)));
			px = ((y3 - y1) * (pow(y2,2.0) - pow(y1,2.0) + pow(x2,2.0) - pow(x1,2.0)) - (y2 - y1) * (pow(y3,2.0) - pow(y1,2.0) + pow(x3,2.0) - pow(x1,2.0))) / (2 * ((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)));
			r = sqrt(pow(px - x1,2.0) + pow(py - y1,2.0));
		}
		printf("%f %f %f\n",px,py,r);
	}
	return 0;
}