Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		cal()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func cal() {
	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 <math.h>
#include <cmath>
using namespace std;

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

	for(int i=0; i<3; i++)
		cin >> x[i] >> y[i];

	double a,b,c,d,e,f;
	a = x[1] - x[0];
	b = y[1] - y[0];
	c = x[2] - x[0];
	d = y[2] - y[0];
	e = (-pow(x[0],2.0)+pow(x[1],2.0)-pow(y[0],2.0)+pow(y[1],2.0))/2;
	f = (-pow(x[0],2.0)+pow(x[2],2.0)-pow(y[0],2.0)+pow(y[2],2.0))/2;

	double Xo = (d*e-b*f)/(a*d-b*c);
	double Yo;
	if(b != 0)
		Yo=(e-a*Xo)/b;
	else
		Yo=(f-c*Xo)/d;

	cout << fixed;
	cout << setprecision(3) << Xo << " " << Yo << " " << sqrt(pow(Xo-x[0],2.0)+pow(Yo-y[0],2.0)) << endl;

return 0;
}

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

void gradcut(double *a,double *b,double x1,double y1,double x2,double y2);

int main() {
    double x[3],y[3],a[2],b[2],rx,ry,r;
    int n;
    std::cin >> n;
    for(int j=0;j<n;j++){
        int am=0,add=1;;
        for(int i=0;i<3;i++) std::cin >> x[i] >> y[i];
        for(int i=0;i<3;i++){
            if(i==2) add=-2;
            if(x[i]!=x[i+add]&&y[i]!=y[i+add]){
                gradcut(&a[am],&b[am],x[i],x[i+add],y[i],y[i+add]);
                am++;
                if(am>2) break;
            }else if(x[i]==x[i+add]){
                a[am]=0;
                b[am]=(y[i]+y[i+add])/2;
                am++;
                if(am>2) break;
            }
        }


        rx = (b[1]-b[0])/(a[0]-a[1]);
        ry = a[0]*rx+b[0];
        r=sqrt((x[0]-rx)*(x[0]-rx)+(y[0]-ry)*(y[0]-ry));
        printf("%.3f %.3f %.3f",rx,ry,r);
    }
    return 0;
}

void gradcut(double *a,double *b,double x1,double x2,double y1,double y2){
    *a=-(x2-x1)/(y2-y1);
    *b=(y1+y2)/2-*a*(x1+x2)/2;
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <iomanip>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define SQ(i) ((i) * (i))
using namespace std;

int main(){
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2, x, y, a, b, c, cos_a, sin_a, r;
  int n;
  scanf("%d", &n);
  while(n--){
    scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
    a1 = 2*(x2-x1);
    b1 = 2*(y2-y1);
    c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
         
    a2 = 2*(x3-x1);
    b2 = 2*(y3-y1);
    c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
    x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
    y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    r = SQ(x3-x) + SQ(y3 - y);
    r = sqrt(r);
    printf("%.3f %.3f %.3f\n",x, y, r);
  }
  return 0;
}

C++: /* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* include {{{ */
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <iostream>
#include <algorithm>

using namespace std;

/*  }}} */
/* cpp template {{{*/


#define endl '\n'
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;      // ??§?¨?????????????double???long double?????????
typedef long long ll;
typedef long double lb;
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W){return (y >= 0 && x >= 0 && y < H && x < W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}

/* ?????° */
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


/* }}} */

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // ???????????????
  return a1 + d1/d2 * (a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main()
{
  //cin.tie(0);
  //ios::sync_with_stdio(false);

  int x = in();
  
  for (int i = 0; i < x; i++){
    D a1, a2, b1, b2, c1, c2;
    cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2;
    P p = circumcenter( P(a1, a2), P(b1, b2), P(c1, c2));
    D r = sqrt(pow(a1 - p.X, 2) + pow(a2 - p.Y, 2));
    printf("%.3f %.3f %.3f", p.X, p.Y, r);

    cout << endl;
  }
  return (0);
}

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

using namespace std;

typedef complex<double> Point;

bool eqv(double d1, double d2) {
    return abs(d1-d2) < 1e-4;
}

double r_(double x) {
    if(abs(x) < 0.001) return 0;
    return x;
}

int main() {
    int N;

    cin >> N;
    while(N--) {
        double x1, x2, x3, y1, y2, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        Point p1(x1, y1), p2(x2, y2), p3(x3, y3);

        double R = abs(abs(p3-p2) / sin(arg(p2-p1) - arg(p3-p1))) / 2;
        Point pc1 = (p1+p2) / 2.;
        Point ph1 = (pc1-p1) * Point(0, 1);
        Point pc2 = (p1+p3) / 2.;
        Point ph2 = (pc2-p1) * Point(0, 1);

        //pc1 + k*ph1 == pc2 + l*ph2
        //pc1-pc2 == l*ph2 - k*ph1
        //d = pc1-pc2
        //l*ph2.x - k*ph1.x == d.x
        //l*ph2.y - k*ph1.y == d.y
        Point d = pc1-pc2;
        double det = ph2.real()*-ph1.imag() + ph1.real()*ph2.imag();
        double l = (d.real()*-ph1.imag() - d.imag()*ph2.imag()) / det;
        double k = (d.real()*ph1.real() + d.imag()*ph2.real()) / det;
        Point center = pc1 + ph1 * k;
        R = abs(center-p1);

        printf("%.3f %.3f %.3f\n", r_(center.real()), r_(center.imag()), r_(R));
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

double distance(double x1, double y1, double x2, double y2){
    return sqrt(pow(abs(x1-x2), 2)+pow(abs(y1-y2), 2));
}

int main(){
    int q; cin>> q;
    for(int z=0; z < q; z++){
        double x1,y1,x2,y2,x3,y3;
        cin >> x1 >>y1 >>x2 >>y2 >>x3 >>y3;
        double a = distance(x1, y1, x2, y2), b = distance(x2, y2, x3, y3), c = distance(x3, y3, x1, y1);
        double s = (a+b+c)/2;
        double r = (a*b*c)/(4.*sqrt(s*(s-a)*(s-b)*(s-c)));
        double a1 = 2*(x2-x1), b1 = 2*(y2-y1), c1 = x1*x1-x2*x2+y1*y1-y2*y2;
        double a2 = 2*(x3-x1), b2 = 2*(y3-y1), c2 = x1*x1-x3*x3+y1*y1-y3*y3;
        double x = (b1*c2-b2*c1)/(a1*b2-a2*b1);
        double y = (c1*a2-c2*a1)/(a1*b2-a2*b1);
        printf("%.4f %.4f %.4f\n", x, y, r);
    }
}