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 <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double xy[6],a,b,c,d,e,f,x,y,r;

	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
			cin>>xy[j];

		a=2*(xy[x2]-xy[x1]);
		b=2*(xy[y2]-xy[y1]);
		c=2*(xy[x3]-xy[x2]);
		d=2*(xy[y3]-xy[y2]);
		e=xy[y2]*xy[y2]-xy[y1]*xy[y1]+xy[x2]*xy[x2]-xy[x1]*xy[x1];
		f=xy[y3]*xy[y3]-xy[y2]*xy[y2]+xy[x3]*xy[x3]-xy[x2]*xy[x2];

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);

		if(x<0)
			x-=0.0005;
		else
			x+=0.0005;
		if(y>0)
			y-=0.0005;
		else
			y+=0.0005;
		r=sqrt((xy[x1]-x)*(xy[x1]-x)+(xy[y1]-y)*(xy[y1]-y));
		r+=0.0005;

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

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

double a,b,c,d,e,f,x,y,r;
int n;

double ifof(double a){
	int n = a*1000;
	if(n%10 >= 5)
		n+=10;
	else if(n%10 <= -5)
		n-=10;
	return n/1000.0;
}

double solvex(){
	double k,l;
	k = (c*c)-(a*a)+(d*d)-(b*b)-(2*y*(d-b));
	l = 2*(c-a);
	return k/l;
}

double solvey(){
	double k,l;
	k = ((e-a)*((c*c)-(a*a)+(d*d)-(b*b)))-((c-a)*((e*e)-(a*a)+(f*f)-(b*b)));
	l = 2*(((d-b)*(e-a))-((f-b)*(c-a)));
	return k/l;
}

int main(){
	std::cin >> n;
	for(int i=0; i<n; i++){
		std::cin >> a >> b >> c >> d >> e >> f;
		y = solvey();
		x = solvex();
		r = std::sqrt(((x-a)*(x-a)) + ((y-b)*(y-b)));
		std::printf("%.3f %.3f %.3f\n",ifof(x),ifof(y),ifof(r));
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define P(x) pow(double(x),2)

int n;
double x[3],y[3];
double *xp,*yp,*r;


void c_xpypr(){
	double a1,a2,b1,b2,c1,c2,xa,ya;
	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]));

	xa=(b1*c2-b2*c1)/(a1*b2-a2*b1);
	ya=(c1*a2-c2*a1)/(a1*b2-a2*b1);
	
	*xp=xa;
	*yp=ya;
	*r= (double)(sqrt((long double)(((xa-x[0])*(xa-x[0]))+((ya-y[0])*(ya-y[0])))));

}


int main(){


	int i,j,k;


	while((scanf("%d",&n))!=EOF){
		for(i=0;i<3;i++){
			scanf("%lf",&x[i]);
			scanf("%lf",&y[i]);
		}

		void c_xpypr();


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

	}



}

C++: #include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

struct Point{
    double x,y;
    Point(){}
    Point(double a,double b) : x(a),y(b){}
    Point operator + (Point p){
        return Point(x+p.x,y+p.y);
    }
    Point operator - (Point p){
        return Point(x-p.x,y-p.y);
    }
    Point operator * (double k){
        return Point(x*k,y*k);
    }
};

pair<double,double> Circumcenters(Point p1,Point p2,Point p3){
    double t = ( ((p3.x-p2.x)*(p2.x-p1.x)-(p3.y-p2.y)*(p1.y-p2.y)) / ((p2.x-p1.x)*(p3.y-p1.y)-(p1.x-p3.x)*(p1.y-p2.y)) ) / 2.0;
    cout << t << endl;

    double x = (p1.x+p3.x)/2.0 + t * (p1.y-p3.y);
    double y = (p1.y+p3.y)/2.0 + t * (p3.x-p1.x);
    return make_pair(x,y);
}

int main(){
    int n;cin>>n;
    rep(i,n){
        double x1,y1,x2,y2,x3,y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        double x,y;
        tie(x,y) = Circumcenters(Point(x1,y1),Point(x2,y2),Point(x3,y3));
        double d = sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
        printf("%.3f %.3f %.3f\n",x,y,d);
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double a = -x1 + x2, b = -y1 + y2, c = (-pow(x1, 2) - pow(y1, 2) + pow(x2, 2) + pow(y2, 2)) / 2;
		double d = -x1 + x3, e = -y1 + y3, f = (-pow(x1, 2) - pow(y1, 2) + pow(x3, 2) + pow(y3, 2)) / 2;
		double y = (c*d - a*f) / (b*d - a*e);
		double x = (c - b*y) / a;
		if (isnan((double)x))abort();
		printf("%.3lf %.3lf %.3lf\n", x, y, hypot(x1 - x, y1 - y));
	}
}