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 <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <iomanip>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))

double x[3], y[3];
double l[3];

double GetDist(int a, int b) {
  return sqrt(sqr(x[a] - x[b]) + sqr(y[a] - y[b]));
}

int main(void) {
  int n;
  scanf("%d", &n);
  REP(i, n) {
    REP(j, 3) {
      scanf("%lf%lf", &x[j], &y[j]);
    }

    double D = 2 * (x[0] * (y[1] - y[2]) + x[1] * (y[2] - y[0]) + x[2] * (y[0] - y[1]));
    double xc = 1.0 / D * ((sqr(x[0]) + sqr(y[0])) * (y[1] - y[2]) + (sqr(x[1]) + sqr(y[1])) * (y[2] - y[0]) + (sqr(x[2]) + sqr(y[2])) * (y[0] - y[1]));
    double yc = 1.0 / D * ((sqr(x[0]) + sqr(y[0])) * (x[2] - x[1]) + (sqr(x[1]) + sqr(y[1])) * (x[0] - x[2]) + (sqr(x[2]) + sqr(y[2])) * (x[1] - x[0]));

    double p = 0;
    REP(j, 3) {
      l[j] = GetDist(j, (j + 1) % 3);
      p += l[j];
    }

    p /= 2;

    double r = 1;
    double z = p;
    REP(j, 3) {
      r *= l[j];
      z *= (p - l[j]);
    }

    r = r / (4 * sqrt(z));

    printf("%.6lf %.6lf %.6lf\n", xc, yc, r);


  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
#define sqr(n) ((n) * (n))
using namespace std;

void equation(double a, double b, double c, double d, double e, double f, double *x, double *y)
{
  *x = (c * e - b * f) / (a * e - b * d);
  *y = (a * f - c * d) / (a * e - b * d);   
}

int main()
{
  int n;
  double x1, y1, x2, y2, x3, y3, x, y;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    x = y = 0;
    equation((2 * (x2 - y1)), (2 * (y2 - y1)), (sqr(x2) + sqr(y2) - sqr(x1) - sqr(y1)), (2 * (x3 - y1)), (2 * (y3 - y1)), (sqr(x3) + sqr(y3) - sqr(x1) - sqr(y1)), &x, &y);
    cout << fixed << setprecision(3) << x + 0.0001 << ' ' <<  y + 0.0001 << ' ' << sqrt(sqr(x1 - x) + sqr(y1 - y)) << endl;
  }
}

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

int main()
{
	int i,n,flg=0;
	double x1,x2,x3,y1,y2,y3;
	double m1,m2,xm1,xm2,ym1,ym2,xo,yo,r;
	//m1,m2…辺の法線　xm1,ym1…辺の中点の座標

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

		xm1=(x1+x2)/2;
		xm2=(x2+x3)/2;
		ym1=(y1+y2)/2;
		ym2=(y2+y3)/2;
		
		if(y1-y2!=0){
			m1=(-1)*(x1-x2)/(y1-y2);
		}else if(y1-y2==0) flg=1;
		if(y2-y3!=0)		m2=(-1)*(x2-x3)/(y2-y3);
		else if(y2-y3==0)	flg=2;
		
		if(flg==0) 	xo=(m1*xm1-m2*xm2+ym2-ym1)/(m1-m2);
		else if(flg==1)xo=xm1;
		else if(flg=2) xo=xm2;

		if(flg==1)yo=m2*(xo-xm2)+ym2;
		else		yo=m1*(xo-xm1)+ym1;
		r=sqrt((x1-xo)*(x1-xo)+(y1-yo)*(y1-yo));
		printf("%.3lf %.3lf %.3lf \n",xo,yo,r);
	}
}

C++: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace contest10
{
    class Program
    {
        static void Main(string[] args)
        {
            var read_line_origin = Console.ReadLine();

            if (string.IsNullOrEmpty(read_line_origin))
            {
                return;
            }

            //三角形の数
            int all_num = int.Parse(read_line_origin);

            
            //空白で分割する
            read_line_origin = Console.ReadLine();
            string[] words = read_line_origin.Split();

            for (int i = 0; i < all_num; i++)
            {
                //配列の要素、すべてに処理を行う
                var num_array = Array.ConvertAll(words, len => double.Parse(len));

                //三角形の座標
                double x1 = num_array[(i * 6) + 0];
                double y1 = num_array[(i * 6) + 1];
                double x2 = num_array[(i * 6) + 2];
                double y2 = num_array[(i * 6) + 3];
                double x3 = num_array[(i * 6) + 4];
                double y3 = num_array[(i * 6) + 5];

                //辺の長さ
                double r1 = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
                double r2 = Math.Sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
                double r3 = Math.Sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));

                //計算用
                double tmp_1 = (r1 * r1) * (r2 * r2 + r3 * r3 - r1 * r1);
                double tmp_2 = (r2 * r2) * (r3 * r3 + r1 * r1 - r2 * r2);
                double tmp_3 = (r3 * r3) * (r1 * r1 + r2 * r2 - r3 * r3);

                double tri_tmp = tmp_1 + tmp_2 + tmp_3;

                double center_x = (tmp_1 * x1 + tmp_2 * x2 + tmp_3 * x3) / tri_tmp;
                double center_y = (tmp_1 * y1 + tmp_2 * y2 + tmp_3 * y3) / tri_tmp;

                double x = (((x1 * x1 + y1 * y1) * (y2 - y3)) +
                            ((x2 * x2 + y2 * y2) * (y3 - y1)) +
                            ((x3 * x3 + y3 * y3) * (y1 - y2)))
                            /
                            ((x1 * (y2 - y3)) +
                             (x2 * (y3 - y1)) +
                             (x3 * (y1 - y2))
                            ) * 0.5;
                double y = (((x1 * x1 + y1 * y1) * (x2 - x3)) + ((x2 * x2 + y2 * y2) * (x3 - x1)) + ((x3 * x3 + y3 * y3) * (x1 - x2))) / ((y1 * (x2 - x3)) + (y2 * (x3 - x1)) + (y3 * (x1 - x2))) * 0.5;


                double radius = (r1 * r2 * r3) /
                                Math.Sqrt(
                                    (r1 + r2 + r3) * (-r1 + r2 + r3) * (r1 - r2 + r3) * (r1 + r2 - r3)

                                );

                Console.WriteLine("{0:f3} {1:f3} {2:f3}", x, y, radius);
            }




        }
    }
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int n;
    double x1,x2,x3,y1,y2,y3,A1,B1,C1,A2,B2,C2,X,Y;
    cin>>n;
    while(n!=0){
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&x2,&x3,&y1,&y2,&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);
        printf("%.3lf %.3lf %.3lf\n",X,Y,sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1)));
        n--;
    }
    return 0;
}