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 <iomanip>
#include <cmath>

using namespace std;

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

  cin >> datasetnum;

  for (int loopcount = 0; loopcount < datasetnum; loopcount++) {
    double px,py,r;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    double len_1 = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
    double len_2 = sqrt(pow(x1-x3,2)+pow(y1-y3,2));
    double len_3 = sqrt(pow(x2-x1,2)+pow(y2-y1,2));

    double s = (len_1+len_2+len_3)/2;
    double area = sqrt(s*(s-len_1)*(s-len_2)*(s-len_3));

    double sin_1 = 2*area/(len_2*len_3);

    r = len_1/(2*sin_1);

    double a = x1 - x3;
    double b = y1 - y3;
    double c = pow(x1,2)-pow(x3,2)+pow(y1,2)-pow(y3,2);
    double d = x2 - x3;
    double e = y2 - y3;
    double f = pow(x2,2)-pow(x3,2)+pow(y2,2)-pow(y3,2);

    px = (c*e-b*f)/(2*(a*e-b*d));
    py = (c*d-a*f)/(2*(b*d-a*e));

    cout << setprecision(4) << px << " " << py << " " << r << endl;
  }

  return 0;
}

C++: #include "bits/stdc++.h"
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)
 
#define EPS (1e-10)
class P{                    //?????§?????????
public:
    double x,y;
     
    P(double _x=0,double _y=0):x(_x),y(_y){};
    P operator + (const P &p     )const{ return P( x+p.x , y+p.y ); }  //?????\?????°???§??????????
    P operator - (const P &p     )const{ return P( x-p.x , y-p.y ); }  //????????????????´???§??????????
    P operator * (const double k )const{ return P( x*k   , y*k    ); } //????????????????????§??????????
    P operator / (const double k )const{ return P( x/k   , y/k    ); } //????????????????????§??????????
     
    bool operator == (const P &p){ return ( fabs(x-p.x)<EPS && fabs(y-p.y)<EPS ); }
    bool operator < (const P &p) const{ return ( x!=p.x ? x<p.x:y<p.y ); }
     
    double norm(){ return x*x+y*y; }        //?????£????´?????£????´????????£????´?
    double abs() { return sqrt(norm()); }   //?????\???????????§?????£??????¬??£?????
    void normalize() {double d = sqrt(x*x+y*y); x /= d; y /= d;}    //?????????????????£?????¨??????????????\???????
};
struct C{P p;double r;};    //?????\?????
struct S{P p1,p2;};         //?????§??????????????\???????
typedef vector<P> Polygon;  //?????\??????????????¨?????§????´\??\???????????¢
typedef P Vector;           //?????£????´?????£??????????????£????´?????£????´???
typedef S L;                //?????§????´¢??´?????§??????????
 
double dot  (Vector a,Vector b) { return a.x*b.x+a.y*b.y; }
double cross(Vector a,Vector b) { return a.x*b.y-a.y*b.x; }
double sqDist(P a, P b)         {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}
double dist (P a, P b)          {return sqrt(sqDist(a,b));}
Vector vec(S a)                 {return P(a.p2.x-a.p1.x,a.p2.y-a.p1.y);}
 
 
//?????§??????????????\?????????£????????????\????\???\??§????´¢??´????????????????????§??????????????\?????????§????´¢??´?????§??????????????£???????´\????????±?????\??£?????????£???????
S getBisector(P a, P b){
    Vector vect = vec(S{a,b});
    P n = P(vect.y, -vect.x);
    n.normalize();
    P cent = (a+b)/2.0;
    return S{cent,cent+n};
}
 
 
// ?????§????´¢??´?????§??????????????£??????¨?????§????´¢??´?????§??????????????£??????????????????????????????§????????? vefiried AOJ CGL_2
P getCrossPointSS(S l1, S l2){
    double A = cross(vec(l1), vec(l2));
    double B = cross(vec(l1), l1.p2 - l2.p1);
    if(abs(A)<EPS && abs(B)<EPS) return l2.p1; // ????????????????????§????´¢??´?????§??????????????£????????????????¬??£????????????£??????£?????£????????????£???????£???????
    if(abs(A)<EPS) assert(false); // ?????§????´¢??´?????§??????????????£???????????????????????????£???????????£???????????£????????????£?????
    return l2.p1 + vec(l2) * B / A;
}
 
 
int main(){
    int n;
    cin>>n;
    rep(hoge,n){
        vector<P> points(3);
        rep(i,3)cin>>points[i].x>>points[i].y;
         
        vector<S> bisectors(2);
        rep(i,2) bisectors[i] = getBisector(points[i], points[i+1]);
         
        P cent = getCrossPointSS(bisectors[0], bisectors[1]);
         
         
        printf("%.3lf %.3lf %.3lf\n",cent.x,cent.y,dist(cent,points[1]));
    }
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main()
{
    int n;
	double ax,ay,bx,by,cx,cy,x,y,r;
	double A1,B1,C1,A2,B2,C2;
	cin>>n;
	while(n--){
		cin>>ax>>ay>>bx>>by>>cx>>cy;
		A1=2*(bx-ax);
		B1=2*(by-ay);
		C1=ax*ax-bx*bx+ay*ay-by*by;
		A2=2*(cx-ax);
		B2=2*(cy-ay);
		C2=ax*ax-cx*cx+ay*ay-cy*cy;
		x=(B1*C2-B2*C1)/(A1*B2-A2*B1);
		y=(C1*A2-C2*A1)/(A1*B2-A2*B1);
		r=sqrt((ax-x)*(ax-x)+(ay-y)*(ay-y));
		printf("%.3f %.3f %.3f\n",x,y,r);
	}
    return 0;
}