Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

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

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

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));
}

#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 << its.first << " " << its.second << " ";
  cout << point_distance(its, p1) << 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++: #include <cstdio>
#include <iostream>
#include <complex>

using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P, point;

point three_point_circle(const point& a, const point& b, const point& c) {
  point x = 1.0/conj(b - a), y = 1.0/conj(c - a);
  return (y-x)/(conj(x)*y - x*conj(y)) + a;
}

int main()
{
	int n;

	cin >> n;
	for (int i = 0; i < n; i++){
		point points[3];
		for (int j = 0; j < 3; j++){
			double x, y;
			cin >> x >> y;
			points[j] = point(x, y);
		}
		point center = three_point_circle(points[0], points[1], points[2]);
		printf("%.3f %.3f %.3f\n", real(center), imag(center), abs(center - points[0]));
	}
}

C++: #include<iostream>
#include<math.h>
using namespace std;

int main()
{
    int n;
    int x1,x2,x3,y1,y2,y3;
    cin>>n;
    while(n--)
    {
        double x,y,r,dx,dy;
        cin>>x1<<y1<<x2<<y2<,x3<<y3;
        dx=(x2+x3-2*x1)/2;
        dy=(y2+y3-2*y1)/2;
        x=x1+dx;
        y=y1+dy;
        r=sqrt(dx*dx+dy*dy);
        printf("%.3f %.3f %.3f\n",x,y,r);
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
 
using namespace std;
typedef struct { double x; double y;} point;
  
point getCircumcenter(point a, point b, point c)
{
    double A1 = 2.0f * ( b.x - a.x );
    double B1 = 2.0f * ( b.y - a.y );
    double C1 = pow(a.x,2)-pow(b.x,2) + pow(a.y,2)-pow(b.y,2);
    double A2 = 2.0f * ( c.x - a.x );
    double B2 = 2.0f * ( c.y - a.y );
    double C2 = pow(a.x,2)-pow(c.x,2) + pow(a.y,2)-pow(c.y,2);
    double X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1);
    double Y = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1);
    point P;
    P.x=X;
    P.y=Y;
    return P;
}
 
double getTwoPointDictance(point a, point b)
{
    return fabs(sqrt(pow((a.x-b.x),2)+pow((a.y-b.y),2)));
}
double AntiMinusZero(double n)
{
    if(n==0)
    {
        return 0.0f;
    }
    return n;
}
 
int main()
{
    int n;
    cin>>n;
    point a,b,c;
    while(n--)
    {
        cin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y;
        point ans = getCircumcenter(a,b,c);
        printf("%.3lf %.3lf %.3lfn", AntiMinusZero(ans.x), AntiMinusZero(ans.y), getTwoPointDictance( a, ans));
    }
}