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 <cmath>
#include <cstdio>
using namespace std;

void swap(double &x,double &y){
	double t;
	t=x;
	x=y;
	y=t;
}

double cut4(double x){
	double temp=x*pow(10,3);
	temp=double(int(temp+0.5));
	return temp*pow(10,-3);
}

int main(){
	int n;
	double x1,x2,x3,y1,y2,y3,px,py;
	double a,b,c,d,r;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		if(x1==x2){
			swap(x2,x3);
			swap(y2,y3);
		}else if(x2==x3){
			swap(x1,x2);
			swap(y1,y2);
		}
		a=(y2-y1)/(x2-x1);
		c=(y3-y2)/(x3-x2);
		if(a&&c){
			a=-1/a;
			c=-1/c;
			b=(y1+y2)/2-a*(x1+x2)/2;
			d=(y2+y3)/2-c*(x2+x3)/2;
			px=(b-d)/(c-a);
			py=(b*c-a*d)/(c-a);
		}else if(!a){
			c=-1/c;
			d=(y2+y3)/2-c*(x2+x3)/2;
			px=(x1+x2)/2;
			py=c*(x1+x2)/2+d;
		}else if(!c){
			a=-1/a;
			b=(y1+y2)/2-a*(x1+x2)/2;
			px=(x2+x3)/2;
			py=a*(x2+x3)/2+b;
		}

		r=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
		
		printf("%.3lf %.3lf %.3lf\n",cut4(px),cut4(py),cut4(r));
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#ifndef typeof
#define typeof __typeof__
#endif // typeof

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define repby(i, a, b, step) for(typeof(b) i = (a); i < (b); i += (step))
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

typedef pair<double, double> point;

struct line { // y = inc*x + c
  double inclination;
  double constant;
  bool xf; // if 0: y = c;
  bool yf; // if 0: x = c;
  line(double i, double c) : inclination(i), constant(c), xf(true), yf(true) {}
  line(double c, bool x, bool y) : constant(c), xf(x), yf(y) {}
};

double line_const(double inc, point &p) {
 return p.second - inc * p.first;
}

line make_line(point &p1, point &p2) {
  double inc;

  if (p2.first == p1.first)
    return line(p2.first, true, false);

  if (p2.second == p1.second)
    return line(p2.second, false, true);

  inc = (p2.second - p1.second) / (p2.first - p1.first);
  return line(inc, line_const(inc, p1));
}

line diagonal_line(line &l, point &p) {
  if (l.xf && l.yf) {
    double inc = -l.inclination;
    return line(inc, line_const(inc, p));
  } else {
    if (l.xf) {
      return line(p.second, false, true);
    } else {
      return line(p.first, true, false);
    }
  }
}

point middle_point(point &p1, point &p2) {
  double mx = (p1.first + p2.first) / 2;
  double my = (p1.second + p2.second) / 2;
  return point(mx, my);
}

point intersection_const(line l, line c)
{
  if (c.xf) {
    double x = c.constant;
    double y = l.inclination * x + l.constant;
    return point (x, y);
  } else {
    double y = c.constant;
    double x = (y - l.constant) / l.inclination;
    return point (x, y);
  }
}
point intersection(line l1, line l2)
{
  // y = inc1 * x + con1
  // y = inc2 * x + con2
  // inc2 * x + con2 = inc1 * x + con1
  if (l1.xf && l1.yf && l2.xf && l2.yf) {
    if (l2.inclination == l1.inclination) {
      cerr << "Error: Input is not a triangle" << endl;
      return point(0,0);
    }

    double x = (l1.constant - l2.constant) / (l2.inclination - l1.inclination);
    double y = l1.inclination * x + l1.constant;
    return point(x, y);
  } else if (l1.xf && l1.yf) { // l2: x = c || y = c
    return intersection_const(l1, l2);
  } else if (l2.xf && l2.yf) {
    return intersection_const(l2, l1);
  } else {
    if (l1.xf) {
      return point(l1.constant, l2.constant);
    } else {
      return point(l2.constant, l1.constant);
    }
  }
}

double point_distance(point p1, point p2)
{
  return sqrt(pow(p2.first - p1.first, 2) + pow(p2.second - p1.second, 2));
}

double round_to(double x, int decimal_digit)
{
  ll xll = ll(x * pow(10, decimal_digit+1));
  xll = (xll + 5) / 10;
  return double(xll) / pow(10, decimal_digit);
}

#define dbg(i) cout << #i << " " << i << endl;
void pcircle(point p1, point p2, point p3)
{
  line line12 = make_line(p1, p2);
  line line23 = make_line(p2, p3);
  point m12 = middle_point(p1, p2);
  point m23 = middle_point(p2, p3);
  line diag_line12 = diagonal_line(line12, m12);
  line diag_line23 = diagonal_line(line23, m23);

  point its = intersection(diag_line12, diag_line23);
  cout.setf(ios::fixed);
  cout.precision(3);
  cout << round_to(its.first, 3) << " " << round_to(its.second, 3) << " ";
  cout << round_to(point_distance(its, p1), 3) << endl;
}

int main(int argc, char **argv)
{
  int n;
  double a, b, c, d, e, f;

  cin >> n;
  while (n--) {
    cin >> a >> b >> c >> d >> e >> f;
    pcircle(point(a, b), point(c, d), point(e, f));
  }

  return 0;
}

C++: //ツ三ツ角ツ形ツづ個外ツ静堋円ツづ個陳?心ツづ? ツ三ツ角ツ形ツづ個静シツ閉ェツづ個青つ陳シツ禿アツ督卍閉ェツ静シツつェツ古ーツづュツづゥツ湘ェツ渉環づ可づ按づゥ.
//ツつアツづ個づヲツつ、ツづ按甘エツ可スツ学ツ的ツづ按姪「ツ妥ィツづーツ嘉ーツつュツづ?つォツづ? ツ暗按可コツづ個ペ-ツジツづ個δ可イツブツδ可δ環づーツ参ツ考ツづ可つキツづゥツづ?嘉ーツつォツづ「ツつキツつ「.
// - http://www.deqnotes.net/acmicpc/2d_geometry/
// - http://www.prefield.com/algorithm/index.html

#include <iostream>
#include <complex>
#include <vector>
using namespace std;

typedef complex<double> P;

P p[3]; //ツ三ツ角ツ形ツづ個三ツ点

//ツ外ツ静?
double cross(const P &a, const P &b){
  return imag(conj(a) * b);
}

//ツ静シツ閉ェ/ツ陳シツ静シツ用ツづ個型
struct L : public vector<P> {
  L(const P &a, const P &b){
    push_back(a);
    push_back(b);
  }
};

//ツ陳シツ静シ2ツづつづ個古ーツ点ツづーツ仰?づ淞づゥ
P crosspoint(const L &l, const L &m){
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  return m[0] + B / A * (m[1] - m[0]);
}

//ツ静シツ閉ェabツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづーツ仰?づ淞づゥ
L getBisection(const P &a, const P &b){
  P s = (a + b) / 2.0; //ツ陳?点
  P t = (b - a) * P(0, 1); //ツ静シツ閉ェabツづ個法ツ静シツベツクツトツδ仰づーツ偲ヲツ督セ

  //ツ静シツ閉ェabツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづ? ツ点sツつゥツづァs+tツづ鳴伸ツづ堕づゥツ陳シツ静シ
  return L(s, s + t);
}

void solve(){
  //ツ三ツ角ツ形ツづ個静シツ閉ェツづ個青つ陳シツ禿アツ督卍閉ェツ静シツづー2ツづつ偲ヲツ督セツつキツづゥ
  L l1 = getBisection(p[0], p[1]);
  L l2 = getBisection(p[1], p[2]);

  //ツ外ツ静堋円ツづ個陳?心ツづ? l1ツづ?2ツつェツ古ーツ債キツつオツつスツ点
  P o = crosspoint(l1, l2);

  //ツ三ツ角ツ形ツづ個任ツ暗督づ個陳クツ点ツつゥツづァ, ツ陳?心ツづ慊づ?づ個仰猟猟」ツづーツ偲ヲツづェツづ? ツ板シツ径ツづ可づ按づゥ
  printf("%.3f %.3f %.3f\n", o.real(), o.imag(), abs(o - p[0]));
}

int main(){
  int n;
  cin >> n;

  for(int i = 0; i < n; i++){
    for(int j = 0; j < 3; j++){
      cin >> p[j].real() >> p[j].imag();
    }

    solve();
  }
}

C++: #include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

int main(void){
	int n , i , buf;
	float x1,x2,x3,y1,y2,y3,a1,a2,b1,b2,c1,c2,xp,yp,r;
	scanf("%d" , &n);
	for(i=1;i<=n;i++){
		scanf("%f %f %f %f %f %f" , &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;
		xp = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
		yp = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
		r = sqrt((xp - x1) * (xp - x1) + (yp - y1) * (yp - y1));
		printf("%.3f %.3f %.3f\n" , xp , yp , r);
	}
	return 0;
}