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<stdio.h>
#include<math.h>
#define P(x) pow(double(x),2)
 
 
 
int main(){
 
 
    int i,j,k;
    int n;
    double x[3],y[3];
    double xp,yp,r;
    double a1,a2,b1,b2,c1,c2;
     
    while((scanf("%d",&n))!=EOF){
        for(i=0;i<3;i++){
            scanf("%lf",&x[i]);
            scanf("%lf",&y[i]);
        }
        a1=2*(x[1]-x[0]);
        a2=2*(x[2]-x[1]);
        b1=2*(y[1]-y[0]);
        b2=2*(y[2]-y[1]);
        c1=(P(x[0])-P(x[1])+P(y[0])-P(y[1]));
        c2=(P(x[1])-P(x[2])+P(y[1])-P(y[2]));
     
        xp=(b1*c2-b2*c1)/(a1*b2-a2*b1);
        yp=(c1*a2-c2*a1)/(a1*b2-a2*b1);
        r=(double)(sqrt((long double)(((xp-x[0])*(xp-x[0]))+((yp-y[0])*(yp-y[0])))));  
 
 
        printf("%.3f %.3f %.3f\n",xp,yp,r);
 
    }
 
 
 
}

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

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int n;
    std::cin >> n;
    while (n--) {
        /* A(x1, y1)
         * B(x2, y2)
         * C(x3, y3)
         * */
        double x1, y1, x2, y2, x3, y3;
        double px, py, r;
        double radA, radB, radC;
        double a, b, c;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        a = std::sqrt(std::pow(x3 -  x2, 2) + std::pow(y3 - y2, 2));
        b = std::sqrt(std::pow(x1 -  x3, 2) + std::pow(y1 - y3, 2));
        c = std::sqrt(std::pow(x2 -  x1, 2) + std::pow(y2 - y1, 2));
        radA = std::acos((b*b + c*c - a*a) / (2*b*c));
        radB = std::acos((c*c + a*a - b*b) / (2*c*a));
        radC = std::acos((a*a + b*b - c*c) / (2*a*b));
        double sin2A = std::sin(2*radA);
        double sin2B = std::sin(2*radB);
        double sin2C = std::sin(2*radC);
        px = (sin2A*x1 + sin2B*x2 + sin2C*x3) / (sin2A + sin2B + sin2C);
        py = (sin2A*y1 + sin2B*y2 + sin2C*y3) / (sin2A + sin2B + sin2C);
        r = a / (2 * std::sin(radA));
        std::printf("%.3lf %.3lf %.3lf\n", px, py, r);
        //std::printf("(x1,y1)=(%.1lf,%.1lf)\n(x2,y2)=(%.1lf,%.1lf)\n(x3,y3)=(%.1lf,%.1lf)\n", x1, y1, x2, y2, x3, y3);
        //std::printf("a:%.3lf b:%.3lf c:%.3lf\n", a, b, c);
        //std::printf("radA:%.3lf radB:%.3lf radC:%.3lf\n", radA, radB, radC);
        //std::printf("A:%.3lf B:%.3lf C:%.3lf\n", radA * 180 / M_PI, radB * 180 / M_PI, radC * 180 / M_PI);
    }
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;

struct P{
    double x, y;
    double size(){
        return std::sqrt(x*x + y*y);
    }
    double sizeS(){
        return x*x + y*y;
    }
};

P operator+(const P& lp, const P& rp){
    return {lp.x+rp.x, lp.y+rp.y};
}

P operator-(const P& lp, const P& rp){
    return {lp.x-rp.x, lp.y-rp.y};
}

P operator*(const P& p, const double& k){
    return {k*p.x, k*p.y};
}

double cross(const P& lp, const P& rp){
    return lp.x * rp.y - lp.y * rp.x;
}

int main(){
    int N;
    std::cin >> N;

    REP(i, N){
        P A, B, C, v1, v2, v3;
        std::cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
        v1 = B - A; v2 = C - A, v3 = B - C;

        double sinA = std::abs(cross(v1, v2)) / (v1.size() * v2.size()),
            r = v3.size() / 2.0 / sinA;

        double x = 0.5 * ((A.y-C.y)*(A.sizeS()-B.sizeS()) - (A.y-B.y)*(A.sizeS()-C.sizeS())) / ((A.x-B.x)*(A.y-C.y)-(A.x-C.x)*(A.y-B.y)),
            y = 0.5 * ((A.x-C.x)*(A.sizeS()-B.sizeS()) - (A.x-B.x)*(A.sizeS()-C.sizeS())) / ((A.y-B.y)*(A.x-C.x)-(A.y-C.y)*(A.x-B.x));

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

C++: #include <iostream>
#include <iomanip>
#include <cmath>
int main()
{
  int n;
  std::cin >> n;
  while (n--) {
    double x1, y1, x2, y2, x3, y3, px, py, r;
    std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double c = 2.0 * ((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
    px = ((y3 - y1) * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1) +
          (y1 - y2) * (x3 * x3 - x1 * x1 + y3 * y3 - y1 * y1)) / c;
    py = ((x1 - x3) * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1) +
          (x2 - x1) * (x3 * x3 - x1 * x1 + y3 * y3 - y1 * y1)) / c;
    r = std::sqrt(std::pow(x1 - px, 2) + std::pow(y1 - py, 2));
    std::cout << std::fixed << std::setprecision(3) << px << " " <<
      py << " " << r << std::endl;
  }
  return 0;
}

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

int main()
{
	int n;
	double x1,y1,x2,y2,x3,y3,xp,xp1,xp2,yp1,yp2,yp,r;
	scanf("%d",&n);

	for(int x=0;x<n;x++)
	{
		scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
		xp1=(y1-y3)*(y1*y1 -y2*y2 +x1*x1 -x2*x2) -(y1-y2)*(y1*y1 -y3*y3 +x1*x1 -x3*x3);
		xp2=2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3);
		xp=xp1/xp2;
		yp1=(x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*x1 -x3*x3 +y1*y1 -y3*y3);
		yp2=2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3);
		yp=yp1/yp2;

		r=(x3-xp)*(x3-xp)+(y3-yp)*(y3-yp);
		r=sqrt(r);
		printf("%.3f %.3f %.3f\n",xp,yp,r);
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;

double round(double x){
	if(x > 0) return floor(x + 0.5);
	else return -1.0 * floor(fabs(x) + 0.5);
}

int main()
{
	int n;
	double x1,y1,x2,y2,x3,y3,x,y,r;
	double det,a1,b1,a2,b2,c1,c2;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a1 = 2 * (x1 - x2), b1 = 2 * (y1 - y2);
		a2 = 2 * (x2 - x3), b2 = 2 * (y2 - y3);
		det = a1 * b2 - a2 * b1;
		c1 = (x1*x1 - x2*x2) + (y1*y1 - y2*y2);
		c2 = (x2*x2 - x3*x3) + (y2*y2 - y3*y3);
		x = (a1 * c1 + b1 * c2) / det;
		y = (a2 * c1 + b2 * c2) / det;
		r = sqrt((x - x1)*(x - x1) + (y - y1)*(y - y1));
		x = round(x * 1000) / 1000;
		y = round(y * 1000) / 1000;
		r = round(r * 1000) / 1000;
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}