Go: package main

import (
	"fmt"
	"math"
)

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

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

func circleTriangle() {
	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<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++: #include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;

typedef complex<double> P; /* ツ点 */

int main(){
	int n;
	cin>>n;
	double x1, y1, x2, y2, x3, y3;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3){
		double a1 = 2*(x2-x1);
		double b1 = 2*(y2-y1);
		double c1 = x1*x1-x2*x2+y1*y1-y2*y2;
		double a2 = 2*(x3-x1);
		double b2 = 2*(y3-y1);
		double c2 = x1*x1-x3*x3+y1*y1-y3*y3;
		double cx = (b1*c2-b2*c1)/(a1*b2-a2*b1);
		double cy = (c1*a2-c2*a1)/(a1*b2-a2*b1);
		P cen2 = P(cx, cy);
		double r2 = abs(P(x1,y1)-cen2);

		printf("%.3f %.3f %.3f\n", real(cen2), imag(cen2), r2);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#define EPS 1e-10
#define EQ(a, b) (abs((a) - (b)))
using namespace std;

typedef complex<double> P;
double cross(P a, P b) {
    return(a.real() * b.imag() - a.imag() * b.real());
}

int main(void) {
    int num; cin >> num;
    
    for(int r = 0; r < num; r++) {
        vector<P> vec;
        for(int c = 0; c < 3; c++) {
            double x, y; cin >> x >> y;
            vec.push_back(P(x, y));
        }
        //中点
        P mid1((vec[0] + vec[1]) / 2.0), mid2((vec[1] + vec[2]) / 2.0);
        //法線ベクトル
        //cout << mid1  << " " << mid2 << endl;
        P cross1((vec[0] - vec[1]) * P(0, 1)), cross2((vec[1] - vec[2]) * P(0, 1));
        //cout << cross1  << " " << cross2 << endl;
        //交点
        P ans(mid1 + cross1 * cross(cross2, (mid2 - mid1)) / cross(cross2, cross1));
        double half_r = abs(ans - vec[0]);
        printf("%.3f %.3f %.3f\n", ans.real(), ans.imag(), half_r);
    }
    return(0);
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???
using std::pow;

int main() {
	int num;
	double x1, y1, x2, y2, x3, y3;
	

	cin >> num;
	for (size_t i = 0; i < num; i++)
	{
		double p, q, r;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		p = ((y1 - y3)*(pow(y1, 2.0) - pow(y2, 2.0) + pow(x1, 2.0) - pow(x2, 2.0)) - (y1 - y2)*(pow(y1, 2.0) - pow(y3, 2.0) + pow(x1, 2.0) - pow(x3, 2.0))) / (2*(y1 - y3)*(x1 - x2) - 2*(y1 - y2)*(x1 - x3));
		q = ((x1 - x3)*(pow(x1, 2.0) - pow(x2, 2.0) + pow(y1, 2.0) - pow(y2, 2.0)) - (x1 - x2)*(pow(x1, 2.0) - pow(x3, 2.0) + pow(y1, 2.0) - pow(y3, 2.0))) / (2*(x1 - x3)*(y1 - y2) - 2*(x1 - x2)*(y1 - y3));

		r = sqrt(pow((p - x1), 2.0) + pow((q - x2), 2.0));

		cout << fixed << setprecision(3) << p << " " << q  << " " << r << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
using namespace std;

#define x real()
#define y imag()
typedef complex<double> Point;

Point circumscribed_Circle_Center(Point a, Point b, Point c){
  double A = a.x - b.x;
  double B = a.y - b.y;
  double C = -1.0 * (a.x*a.x - b.x*b.x + a.y*a.y - b.y*b.y);
  double D = a.x - c.x;
  double E = a.y - c.y;
  double F = -1 * (a.x*a.x - c.x*c.x + a.y*a.y - c.y*c.y);

  double L = (C*E - B*F) / (E*A - B*D);
  double M = (D*C - A*F) / (D*B - E*A);
  double xp = L / -2.0;
  double yp = M / -2.0;
  return (Point(xp, yp));
}

double circumscribed_Circle_Radius(Point a, Point c){
  double L = c.x * -2.0;
  double M = c.y * -2.0;
  double N = -1 * (a.x*a.x + a.y*a.y + L*a.x + M*a.y);
  double r = sqrt(L*L + M*M - 4*N) / 2.0;
  return r;
}

int main(){
  int n;
  Point a, b, c;
  cin >> n;
  while(n--){
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
    Point C = circumscribed_Circle_Center(a, b, c);
    double r = circumscribed_Circle_Radius(a, C);
    printf("%.3f %.3f %.3f\n", C.x, C.y, r);
  }
  return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)


int main(){
    float x1,x2,x3,y1,y2,y3,gx,gy,G,Xc,Yc,r;
    int n;
    scanf("%d", &n);
    for (int i=0;i<n;i++) {
        scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
        gx = (x1+x2+x3)/3;
        gy = (y1+y2+y3)/3;
        G = ( y2*x1-y1*x2 +y3*x2-y2*x3 +y1*x3-y3*x1 );
        Xc = ((x1*x1+y1*y1)*(y2-y3)+(x2*x2+y2*y2)*(y3-y1)+(x3*x3+y3*y3)*(y1-y2))/(2*G);
        Yc = -((x1*x1+y1*y1)*(x2-x3)+(x2*x2+y2*y2)*(x3-x1)+(x3*x3+y3*y3)*(x1-x2))/(2*G);
        r = hypot(x1-Xc, y1-Yc);
        printf("%.3f %.3f %.3f\n", Xc, Yc, r);
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
const double EPS = 1.0e-9;
const double PI = acos(-1);
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int test; cin >> test;
    rep(casenum, test){
        Point a, b, c, m1, m2, d1, d2;
        cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag();
        m1 = (a + b) / 2.0, m2 = (b + c) / 2.0;//????????¨???????????????, ????????¨????????????
        double s1 = arg(b - a) + PI / 2.0, s2 = arg(c - b) + PI / 2.0;//?????¨??´???????????????
        d1 = polar(1.0, s1), d2 = polar(1.0, s2);
        Point mn = m2 - m1;
        double q = (mn.real() / d1.real() - mn.imag() / d1.imag()) / (d2.real() / d1.real() - d2.imag() / d1.imag());
        q *= -1;
        double x = m2.real() + q * d2.real();
        double y = m2.imag() + q * d2.imag();
        double r = abs(Point(x, y) - a);
        cout << x << ' ' << y << ' ' << r << endl;

        printf("%.3lf %.3lf %.3lf\n", x, y, r);
    }
    return 0;
}