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 <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


double dot(Point a, Point b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}
double cross(Point a, Point b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

Point mid(Point a, Point b){
  double x = (a.real()+b.real())/2.0;
  double y = (a.imag()+b.imag())/2.0;
  // cout << a << " " << b << endl;
  return Point(x, y);
}

Point intersection_l(Point a1, Point a2, Point b1, Point b2) {
  Point a = a2 - a1; Point b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}


signed main(){
  int n;
  scanf("%lld", &n);
  rep(i,n){
    vector<Point> vec(3);
    rep(j,3){
      double x, y;
      scanf("%lf%lf", &x, &y);
      vec[j] = Point(x, y);
    }
    
    Point v1 = (vec[1]-vec[0])*Point(0, 1);
    Point v2 = (vec[2]-vec[1])*Point(0, 1);
    Point mid1 = mid(vec[0], vec[1]);
    Point mid2 = mid(vec[1], vec[2]);
    Point p1 = mid1+v1;
    Point p2 = mid2+v2;
    Point p = intersection_l(mid1, p1, mid2, p2);
    printf("%.3lf %.3lf %.3lf\n", p.real(), p.imag(), abs(p-vec[0]));
  }
	return 0;
}

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