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

using namespace std;

struct point {
	double x, y;
}A, B, C;

struct circle {
	double r;
	point cen;
}cir;

//求三角形外接&#22278;&#22278;心坐&#26631;及半径
//&#36755;入三角形三点坐&#26631; 
void solve(point A, point B, point C) {
	double tmp1 = A.x * A.x - B.x * B.x + A.y * A.y - B.y * B.y;
	double tmp2 = A.x * A.x - C.x * C.x + A.y * A.y - C.y * C.y;   //外接&#22278;&#22278;心坐&#26631;公式 
	cir.cen.x = (tmp1 * (A.y - C.y) - tmp2 * (A.y - B.y)) / (2 * (A.y - C.y) * (A.x - B.x) - 2 * (A.y - B.y) * (A.x - C.x));
	cir.cen.y = (tmp1 * (A.x - C.x) - tmp2 * (A.x - B.x)) / (2 * (A.y - B.y) * (A.x - C.x) - 2 * (A.y - C.y) * (A.x - B.x));
	double la = sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y)); //三角形三&#36793;&#38271; 
	double lb = sqrt((B.x - C.x) * (B.x - C.x) + (B.y - C.y) * (B.y - C.y));
	double lc = sqrt((C.x - A.x) * (C.x - A.x) + (C.y - A.y) * (C.y - A.y));
	double p = (la + lb + lc) / 2.0;
	double s = sqrt(p * (p - la) * (p - lb) * (p - lc)); //三角形面&#31215; 
	cir.r = la * lb * lc / (4 * s); //外接&#22278;半径公式 
}

int main() {
	int t;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y);
		solve(A, B, C);
		printf ("%.3lf %.3lf %.3lf\n",cir.cen.x, cir.cen.y, cir.r);
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(3);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    while(n--){
        double x1,x2,x3,y1,y2,y3;
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        double a=2*(x2-x1),b=2*(y2-y1),c=sq(x2)-sq(x1)+sq(y2)-sq(y1),d=2*(x3-x2),e=2*(y3-y2),f=sq(x3)-sq(x2)+sq(y3)-sq(y2);
        double y=(c*d-a*f)/(b*d-a*e);
        double x=(c-b*y)/a;
        if(x==-0)x=0;
        if(y==-0)y=0;
        double r=sqrt(sq(x-x1)+sq(y-y1));
        cout<<x<<" "<<y<<" "<<r<<endl;
    }
}

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

class Triangle{

public:
	double a, b, c;
	double cosA, sinA,R,px,py;

	//con???????§???¢???????????§?¨?????±???????????¬?????¨????????¨????????¨?????°???\???????????????????????£?????????
	double con1, con2, con3,con4,con5,con6;


	Triangle(double x1,double y1,double x2,double y2,double x3,double y3);

	double Radius();
	double Px();
	double Py();

};


//Triangle????????????????????????
Triangle::Triangle(double x1, double y1, double x2, double y2, double x3, double y3){

	a = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
	b = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1));
	c = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3));

	
	cosA = ((b*b) + (c*c) - (a*a)) / (2 * b*c);
	sinA = sqrt(1 - (cosA*cosA));

	R = a / (2 * sinA);

	//????????¬?????????????????§?¨?????±???????
	con1 = (y3 - y2)*(x1*x1) - (y3 - y1)*(x2*x2) + (y2-y1)*(x3*x3);
	con2 = (y3 - y1)*x2 - (y2 - y1)*x3 + (y2 - y3)*x1;
	con3 = (y1*y1)*(y3 - y2) + (y2*y2)*(y1 - y3) + (y3*y3)*(y2 - y1);

	//????????????con1+2px*con2+con3=0??¨??????
	px = (con3 - con1) / (2 * con2);


	con4 = (x3 - x2)*(y1*y1) - (x3 - x1)*(y2*y2) + (x2 - x1)*(y3*y3);
	con5 = (x3 - x1)*y2 - (x2 - x1)*y3 + (x2 - x3)*y1;
	con6 = (x1*x1)*(x3 - x2) + (x2*x2)*(x1 - x3) + (x3*x3)*(x2 - x1);

	py = (con6 - con4) / (2 * con5);


}


//?????\????????????Radius????±?????????¢??°
double Triangle::Radius(){

	R=round(R*1000)/1000;
	return R;
}

//px???????????¢??°
double Triangle::Px(){

	px = floor(px*1000)/1000;
	return px;
}

//py???????????¢??°
double Triangle::Py(){

	py = floor(py*1000) / 1000;
	return py;
}



//??£??????????????¨???????§£???
int main(void){


	int n;
	double x1, x2, x3, y1, y2, y3;
	cin >> n;

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

		Triangle Triangle(x1, y1, x2, y2, x3, y3);
		
		printf("%.3f ", Triangle.Px());
		printf("%.3f ", Triangle.Py());
		printf("%.3f\n",Triangle.Radius());


	}


	return 0;
}

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

double sq (double x) {return (x * x);}

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

	cin >> num;
	for (int i = 0; i < num; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
                //double a = sqrt(SQ(x2 - x1) + SQ(y2 - y1));
                //double b = sqrt(SQ(x3 - x2) + SQ(y3 - y2));
                //double c = sqrt(SQ(x1 - x3) + SQ(y1 - y3));
                double a = hypot(x2 - x1, y2 -y1);
                double b = hypot(x3 - x2, y3 -y2);
                double c = hypot(x1 - x3, y1 -y3);
                double r = (a * b * c) / sqrt( ( a + b + c ) * ( -1 * a + b + c) * ( a - b + c ) * ( a + b - c ) );


                double xp = ((sq(x1) + sq(y1)) * (y2 - y3) + (sq(x2) + sq(y2)) * (y3 - y1) + (sq(x3) + sq(y3)) * (y1 - y2)) / (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2;
                double yp = ((sq(x1) + sq(y1)) * (x2 - x3) + (sq(x2) + sq(y2)) * (x3 - x1) + (sq(x3) + sq(y3)) * (x1 - x2)) / (y1 * (x2 - x3) + y2 * (x3 - x1) + y3 * (x1 - x2)) / 2;

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

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double p[3][2],m[2][2],mi[2][2],det,x[2],o[2];
    for(int i=0; i<3; i++) cin >>p[i][0]>>p[i][1];
    for(int i=1; i<3; i++) for(int j=0; j<2; j++) p[i][j]-=p[0][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) m[i][j] = 2*p[1+i][j];
    for(int i=0; i<2; i++) x[i] = p[i+1][0]*p[i+1][0]+p[i+1][1]*p[i+1][1];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    mi[0][0] = m[1][1]/det;
    mi[0][1] = -m[0][1]/det;
    mi[1][0] = -m[1][0]/det;
    mi[1][1] = m[0][0]/det;
    for(int i=0; i<2; i++) o[i] = mi[i][0]*x[0]+mi[i][1]*x[1];
    printf("%.3lf %.3lf %.3lf\n",o[0]+p[0][0],o[1]+p[0][1],sqrt(o[0]*o[0]+o[1]*o[1]));
  }
  return 0;
}