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<stdio.h>
#include<math.h>
double x1, y1, x2, y2, x3, y3;
double px, py;
int main()
{
    int n;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        double A1 =(x2*x2+y2*y2-x1*x1-y1*y1)*(y3-y1);
        double B1 =(x3*x3+y3*y3-x1*x1-y1*y1)*(y2-y1);
        double A2 =(x3*x3+y3*y3-x1*x1-y1*y1)*(x2-x1);
        double B2 =(x2*x2+y2*y2-x1*x1-y1*y1)*(x3-x1);
        double D = (x2-x1)*(y3-y1)-(y2-y1)*(x3-x1);
        double X=(double)(A1-B1)/D/2;
        double Y=(double)(A2-B2)/D/2;
        double R = sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1));
        printf("%.3f %.3f %.3f\n",X,Y,R);
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
 
int main()
{
    using namespace std;
    int n;
 
    cin >> n;
    for( int i=0; i<n; ++i ) {
        double x1, y1, x2, y2, x3, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
 
        double const p
            = ( ( y1 - y3 ) * ( y1 * y1 - y2 * y2 + x1 * x1 - x2 * x2 ) - ( y1 - y2 ) * ( y1 * y1 - y3 * y3 + x1 * x1 - x3 * x3 ) )
            / ( 2 * ( y1 - y3 ) * ( x1 - x2 ) - 2 * ( y1 - y2 ) * ( x1 - x3 ) );
 
        double const q
            = ( ( x1 - x3 ) * ( x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2 ) - ( x1 - x2 ) * ( x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3 ) )
            / ( 2 * ( x1 - x3 ) * ( y1 - y2 ) - 2 * ( x1 - x2 ) * ( y1 - y3 ) );
 
        double const r1 = sqrt( pow( p - x1, 2 ) + pow( q - y1, 2 ) );
        double const r2 = sqrt( pow( p - x2, 2 ) + pow( q - y2, 2 ) );
        double const r3 = sqrt( pow( p - x3, 2 ) + pow( q - y3, 2 ) );
        double const r = ( r1 + r2 + r3 ) / 3.0;
 
        cout << showpoint << fixed << setprecision( 3 );
        cout << p << " " << q << " " << r << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

double eps = 1e-10;

class Point {
public:
	double x, y;
	
	Point(double x = 0, double y = 0) : x(x), y(y) {}
	
	Point operator + (const Point& p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator - (const Point& p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator * (const double& a) {
		return Point(x * a, y * a);
	}
	Point operator / (const double& a) {
		return Point(x / a, y / a);
	}
	
	bool operator < (const Point& p) const {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator == (const Point &p) const {
		return fabs(x - p.x) < eps && fabs(y - p.y) < eps;
	}
	
	double abs() {
		return sqrt(norm());
	}
	double norm() {
		return x * x + y * y;
	}
	
};

typedef Point Vector;

bool equals(const double& a, const double& b) {
	return fabs(a - b) < eps;
}

double dot(const Vector& a, const Vector& b){
	return a.x * b.x + a.y * b.y;	
}

double cross(const Vector& a, const Vector& b){
	return a.x * b.y - a.y * b.x;
}

class Triangle {
public:
	Point p1, p2, p3; // ??????
	Vector v1, v2, v3; // ??????????????????
	double e1, e2, e3; // ????????§??????
	double a1, a2, a3; // ?§????(????????¢???)
	
	Triangle(Point a, Point b, Point c) : p1(a), p2(b), p3(c) {
		v1 = p3 - p2; v2 = p3 - p1; v3 = p2 - p1;
		e1 = v1.abs(); e2 = v2.abs(); e3 = v3.abs();
		a1 = law_of_cosines(e1, e2, e3); a2 = law_of_cosines(e2, e1, e3);
		a3 = law_of_cosines(e3, e2, e1);
	}
	
	// ????????????(?????????:?§????)
	double law_of_cosines(const double& a, const double& b, const double& c) { 
		return acos((b * b + c * c - a * a) / (2.0 * b * c));
	}
	
	double calc_radius_circumcenter() {
		return e1 / (2.0 * sin(a1));
	}
	// ?????????????????????
	Vector calc_vec_circumcenter() {
		return (v1 * sin(2.0 * a1) + v2 * sin(2.0 * a2) + v3 * sin(2.0 * a3))
		       / (sin(2.0 * a1) + sin(2.0 * a2) + sin(2.0 * a3));
	}
	
	// ???????????§?¨?
	Point calc_p_circumcenter() {
		return Point((p1.x * sin(2.0 * a1) + p2.x * sin(2.0 * a2) + p3.x * sin(2.0 * a3))
		             / (sin(2.0 * a1) + sin(2.0 * a2) + sin(2.0 * a3)),
		             (p1.y * sin(2.0 * a1) + p2.y * sin(2.0 * a2) + p3.y * sin(2.0 * a3))
		             / (sin(2.0 * a1) + sin(2.0 * a2) + sin(2.0 * a3)));
	}
};

int main() {
	int n;
	cin >> n;
	double x1, x2, x3, y1, y2, y3;
	for(int i = 0; i < n; ++i){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		Triangle t = Triangle(Point(x1, y1), Point(x2, y2), Point(x3, y3));
		Point p = t.calc_p_circumcenter();
		printf("%.3f %.3f %.3f\n", p.x, p.y, t.calc_radius_circumcenter());
	}
	return 0;
}

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

using namespace std;

void calculate(double, double, double, double, double, double, double&, double&);

int main(){
  int i, num;
  double x1, y1, x2, y2, x3, y3;
  double a, b, c, d, e, f;
  double l, m, n;
  double xp, yp, r;

  cin >> num;

  for(i=0; i<num; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

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

    calculate(a, b, c, d, e, f, l, m);
    n = -(x1*x1 + y1*y1 + l*x1 + m*y1);

    xp = -l / 2;
    yp = -m / 2;
    r = 0.5 * sqrt(l*l + m*m - 4*n);

    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(3);
    cout << xp << " " << yp << " " << r << endl;
  }

  return 0;
}

void calculate(double a, double b, double c, double d, double e, double f, double& l, double& m){
    l = (c*e - f*b)/(a*e - d*b);

    if(b != 0)
      m = (c - a*l)/b;
    else
      m = (f - d*l)/e;
}

C++: #include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
double ff(double a,int b){
  
  a*=10000.0;
  //  cout<<a<<endl;
  int c = a;
  if(c%10>4)c+=10;
  c/=10;
  return (double)c/1000.0;
}



double ax,ay,bx,by,cx,cy,ox,oy,dx,dy,ex,ey;
//ack はACの傾き  eos はEOの切片
double abk,ack,dok,eok,eos,dos;
int n;
int main(){

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>ax>>ay>>bx>>by>>cx>>cy;
    //ABの中点をD,  ACの中点をE 外接円の中心をO とする
    dx=(ax+bx)/2.0;
    dy=(ay+by)/2.0;
    ex=(ax+cx)/2.0;
    ey=(ay+cy)/2.0;
    
    if(ax==bx){
      abk=(ay-by)/0.0000001;
    }else{
      abk=(ay-by)/(ax-bx);
    }
    if(abk==0.0)abk=0.0000001;
    dok=-1.0/abk;
    dos=dy-dx*dok;
    
    
    if(ax==cx){
      ack=(ay-cy)/0.0000001;
    }else{
      ack=(ay-cy)/(ax-cx);
    }
    if(ack==0.0)ack=0.0000001;
    eok=-1.0/ack;
    eos=ey-ex*eok;
    
    //Y  =  dok X  + dos
    //Y  =  eok X  + eos
    //dok X + dos = eok X + eos
    
    double Y,X;
    if(dok-eok==0.0){
      X=(eos-dos)/0.0000001;
    }else{
      X=(eos-dos)/(dok-eok);
    }
    Y= dok * X + dos;
    
    printf("%.3f %.3f ",ff(X,3),ff(Y,3));
    //cout<<ax<<' '<<X<<' '<<ay<<' '<<Y<<endl;
    printf("%.3f\n" ,  ff( sqrt( pow(ax-X,2) + pow(ay-Y,2) )   ,3)   );
    
    
  }
  return 0;
}