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 <iostream>
#include <stdio.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define int long

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)

constexpr int dx[4] = { 1, 0, -1, 0 };
constexpr int dy[4] = { 0, 1, 0, -1 };

//----------------------------------
//----------------------------------

template<typename STL> inline void print_STL(STL c, string ab = ""){
	cout << ab << c[0];
	for(int i = 1; i < c.size(); ++i) cout << ' ' << c[i]; }

template<typename STL> inline void import_STL(STL& c, int n){
	typename STL::value_type tmp;
	for(int i = 0; i < n; ++i){	cin >> tmp; c.push_back(tmp);} }

istream& operator>>(istream& os, pair<double,double>& x)
{
	double tmp;
	os >> tmp;
	x.first = tmp;
	os >> tmp;
	x.second = tmp;
	return os;
}

ostream& operator<<(ostream& os, pair<double,double>& x)
{
	return os << x.first << ' ' << x.second;
}

pair<double, double> operator-(pair<double,double> a, pair<double,double> b)
{
	return {a.first - b.first, a.second - b.second};
}
pair<double, double> operator+(pair<double,double> a, pair<double,double> b)
{
	return {a.first + b.first, a.second + b.second};
}

double operator*(pair<double, double> a, pair<double,double> b)
{
	return a.first * b.first + a.second * b.second;
}
double sq(double a)
{
	return a * a;
}

double round4(double x)
{
	x *= 1000;
	x = (int)(x + 0.51);
	return x / 1000.;
}

signed main()
{
	pair<double,double> a, b, c;
	int n;
	cin >>n;
	for(int i = 0; i < n; ++i)
	{
		cin >> a >> b >> c;
		pair<double, double> va = b-c, vb = c-a;
		/* cout << va <<' ' << vb << '\n'; */
		/* auto m = b + c, n = c + a; */
		/* m = {m.first / 2, m.second/2}; */
		/* n = {n.first / 2, n.second/2}; */
		double norm = va.first * vb.second - va.second * vb.first;
		/* double cx = va * m , cy = vb * n ; */
		double cx = sq(b.first) + sq(b.second) - sq(c.first) - sq(c.second);
		double cy = sq(c.first) + sq(c.second) - sq(a.first) - sq(a.second);
		double sx = cx * vb.second - cy * va.second;
		double sy = va.first * cy - cx * vb.first;
		sx /= norm * 2;
		sy /= norm * 2;

		double r = sqrt(sq(c.first - sx)+ sq(c.second - sy));
		sx = round4(sx);
		sy = round4(sy);
		r = round4(r);
		printf("%.3lf %.3lf %.3lf\n", sx, sy, r);
	}
}

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

using namespace std;

void getSide(double x1, double y1, double x2, double y2, double x3, double y3, double *a, double *b, double *c) {
    double marginX1, marginX2, marginX3;
    double marginY1, marginY2, marginY3;
    
    marginX1 = fabs(x1 - x2);
    marginX2 = fabs(x2 - x3);
    marginX3 = fabs(x3 - x1);
    marginY1 = fabs(y1 - y2);
    marginY2 = fabs(y2 - y3);
    marginY3 = fabs(y3 - y1);
    
    *a = sqrt(pow(marginX1, 2) + pow(marginY1, 2));
    *b = sqrt(pow(marginX2, 2) + pow(marginY2, 2));
    *c = sqrt(pow(marginX3, 2) + pow(marginY3, 2));
    
}

    // 半径取得の処理
double getR(double a, double b, double c) {
    double r, s;
    s = (a + b + c) / 2;
    r = (a * b * c) / (4 * sqrt(s * (s - a) * (s - b) * (s - c)));
    return r;
}

    // 中心座標を求める処理
void getCentralCoodinate(double x1, double y1, double x2, double y2, double x3, double y3, double *xp, double *yp) {
    double a1, b1, c1;
    double a2, b2, c2;
    double marginX1, marginX3;
    double marginY1, marginY3;
    
    *xp = 0;
    *yp = 0;
    
    marginX1 = fabs(x1 - x2);
    marginX3 = fabs(x3 - x1);
    marginY1 = fabs(y1 - y2);
    marginY3 = fabs(y3 - y1);
    
    a1 = 2 * marginX1;
    b1 = 2 * marginY1;
    a2 = 2 * marginX3;
    b2 = 2 * marginY3;
    
    c1 = pow(x1, 2) - pow(x2, 2) + pow(y1, 2) - pow(y2, 2);
    c2 = pow(x1, 2) - pow(x3, 2) + pow(y1, 2) - pow(y3, 2);
    
    *xp = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
    *yp = (a2 * c1 - a1 * c2) / (a1 * b2 - a2 * b1);
}

    // main処理
int main(void) {
    double x1, x2, x3;
    double y1, y2, y3;
    double xp, yp;
    double a, b, c, r;
    int n;
    
    cin >> n;
    while(n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        getSide(x1, y1, x2, y2, x3, y3, &a, &b, &c);
        r = getR(a, b, c);
        getCentralCoodinate(x1, y1 ,x2, y2, x3, y3, &xp, &yp);
        
        cout << setprecision(3);
        cout << setiosflags(ios::fixed);
        cout << xp << " " << yp << " " << r << endl;
    }
    
    return 0;
}

C++: 
// Circumscribed Circle of a Triangle


#include<stdio.h>
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
	int n;
	cin >> n;
	double x[3];
	double y[3];
	double r;

	while(n--){
	 for(int j=0;j<3;j++){
	 	cin >> x[j] >> y[j];
	 }

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

	 double e = pow(x[1],2.0)-pow(x[0],2.0)+pow(y[1],2.0)-pow(y[0],2.0);
	 double f = pow(x[2],2.0)-pow(x[0],2.0)+pow(y[2],2.0)-pow(y[0],2.0);

	 if(a==0){
	 	swap(a,c);
	 	swap(b,d);
	 	swap(e,f);
	 }

	b = b/a;
	e = e/a;
	a = a/a;
	 
	 
	d = d-b*c;
	f = f-e*c;
	c = c-a*c;

	f = f/d;
	d = d/d;

	b = b-d*b;
	e = e-f*b;

	r = sqrt(pow((e-x[0]),2.0)+pow((f-y[0]),2.0));
	
	cout << fixed;
	cout << setprecision(3) << e <<" "<< f << " " << r << endl;
	}

}

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("%.3f %.3f %.3f\n",px,py,r);
	}
	return 0;
}