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 <math.h>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double x,y,r;
    double a,b,c,d,e,f;
    a=2*x1-2*x2;
    b=2*y1-2*y2;
    c=x1*x1-x2*x2+y1*y1-y2*y2;
    d=2*x2-2*x3;
    e=2*y2-2*y3;
    f=x2*x2-x3*x3+y2*y2-y3*y3;
        x=(b*f-e*c)/(a*e-d*b);
        y=(c*d-f*a)/(a*e-d*b);
        
   r=hypot(x-x1,y-y1);
    
    printf("%.3f %.3f %.3f\n",x,y,r);
}
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;

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

  while(n > 0) {
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double px, py ,r;

    double a1, a2, b1,b2,c1,c2;
    
    a1 = 2*(x2-x1);
    a2 = 2*(x3-x1);
    b1 = 2*(y2-y1);
    b2 = 2*(y3-y1);
    c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
    c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
    px = (b1*c2-b2*c1)/(a1*b2-a2*b1);
    py = (c1*a2-c2*a1)/(a1*b2-a2*b1);
    r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    
    cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
    n--;
  }
  
  return 0;
}

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

const double EPS = 1e-7;
typedef complex<double> P; /* _ */
struct L {                 /* üª */
	P p, q;
	L(P p, P q) : p(p), q(q) {}
};

double cross(P a, P b) { return imag(conj(a)*b); }

// ¼üaÆ¼übÌð_ðvZ·éDæÉð·»èªK{D
P crossPointLL(L a, L b){
	double A = cross(a.q-a.p, b.q-b.p);
	double B = cross(a.q-a.p, a.q-b.p);
	return b.p + B/A * (b.q-b.p);
}

// _pÆ_qÌ¼ñªüðÔ·
L pointBisector(P p, P q) {
	P cen = (p+q)*0.5;
	return L(cen, cen+(q-p)*P(0,1));
}

int main(){
	int n;
	cin>>n;
	double x1, y1, x2, y2, x3, y3;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3){
		// Cuè@
		P p1 = P(x1, y1);
		P p2 = P(x2, y2);
		P p3 = P(x3, y3);
		L l1 = pointBisector(p1, p2);
		L l2 = pointBisector(p2, p3);
		P cen = crossPointLL(l1, l2);
		double r = abs(p1-cen);

		// Êè@
		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(p1-cen2);

		// ÜÆß
		int x1000 = 1000*cen2.real()+0.5;
		int y1000 = 1000*cen2.imag()+0.5;
		int r1000 = 1000*r2+0.5;
		printf("%.3f %.3f %.3f", 1.0*x1000/1000+EPS, 1.0*y1000/1000+EPS, 1.0*r1000/1000+EPS);
		cout<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
	double ax,ay,bx,by,cx,cy,ix,iy,r;
	double abx,aby,acx,acy;
	double fb,fc;
	double ffb,ffc,aaby,aacy;
	int n,a;
	scanf("%d",&n);
	for(a=0;a<n;a++){
		scanf("%lf %lf",&ax,&ay);
		scanf("%lf %lf",&bx,&by);
		scanf("%lf %lf",&cx,&cy);
		abx=bx-ax;
		aby=by-ay;
		acx=cx-ax;
		acy=cy-ay;
		fb=abx*abx+aby*aby;
		fc=acx*acx+acy*acy;
		ffb=fb*acx;
		ffc=fc*abx;
		aaby=aby*acx;
		aacy=acy*abx;
		iy=(ffc-ffb)/((aacy-aaby)*2);
		if(abx!=0){ix=(fb-(2*iy*aby))/(abx*2);}
		if(acx!=0){ix=(fc-(2*iy*acy))/(acx*2);}
		r=sqrt(ix*ix+iy*iy);
		ix=ix+ax;
		iy=iy+ay;
		printf("%.3lf %.3lf %.3lf\n",ix,iy,r);
	}
	return 0;
}

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

int main() {
    double x1, x2, x3, y1, y2, y3;
    int n;
    scanf("%d", &n);
    while (n--) {
        scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
        double a,b,c,d,e,f,x,y,r;
        a=2*(x2-x1);
        b=2*(y2-y1);
        c=x2*x2+y2*y2-x1*x1-y1*y1;
        d=2*(x3-x2);
        e=2*(y3-y2);
        f=x3*x3+y3*y3-x2*x2-y2*y2;
        x=(b*f-e*c)/(b*d-e*a);
        y=(d*c-a*f)/(b*d-e*a);
        r=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
        printf("%.3lf %.3lf %.3lf\n", x, y, r);
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main() {
  int n;
  double x1, x2, x3, y1, y2, y3;
  double a1, a2, b1, b2, c1, c2;
  double x, y, r;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> 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;

    x = (b1*c2 - b2 * c1) / (a1*b2 - a2*b1);
    y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
    r = sqrt((x-x1)*(x-x1) + (y-y1)*(y-y1));

    x *= 1000;
    y *= 1000;
    r *= 1000;

    x += 0.5;
    y += 0.5;
    r += 0.5;

    cout << fixed << setprecision(3) << ((double)((int)x))/1000 << " " << ((double)((int)y))/1000 << " " << ((double)((int)r))/1000 << endl;
  }
  return 0;
}

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

double sqnorm(double x1, double y1, double x2, double y2) {
    return pow((x1 - x2), 2) + pow((y1 - y2), 2);
}

int main(void) {
    int N; cin >> N;
    double x1, y1, x2, y2, x3, y3;
    double lsq, msq, nsq, l, n;
    double cos, a, b, c, d, e, f, det;
    double r, px, py;
    for(int i = 0; i < N; i++) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        lsq = sqnorm(x1, y1, x2, y2);
        msq = sqnorm(x2, y2, x3, y3);
        nsq = sqnorm(x3, y3, x1, y1);
        l = sqrt(lsq);
        n = sqrt(nsq);
        cos = (msq + nsq - lsq) / (2.0 * sqrt(msq * nsq));
        r = sqrt(lsq / (4.0 * (1.0 - cos * cos)));
        a = (x2 - x1) / l;
        b = (y2 - y1) / l;
        c = (x3 - x1) / n;
        d = (y3 - y1) / n;
        e = l / 2.0;
        f = n / 2.0;
        det = a* d - b * c;
        px = (d * e - b * f) / det + x1;
        py = (-c * e + a * f) / det + y1;
        r = roundf(r * 1000.0) / 1000.0;
        px = roundf(px * 1000.0) / 1000.0;
        py = roundf(py * 1000.0) / 1000.0;
        printf("%.3f %.3f %.3f\n", px, py, r);
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
  double x1, y1, x2, y2, x3, y3;
  double px, py;
  double r;
  double M1, mx1, my1;
  double M2, mx2, my2;
  int n;
  cin >> n;

  while(1){
    if(n == 0) break;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    mx1 = (x1 + x2) / 2;
    my1 = (y1 + y2) / 2;
    if(y1 - y2 == 0) M1 = 0;
    else  M1 = (-1)*(x1 - x2) / (y1 - y2);
   

    mx2 = (x2 + x3) / 2;
    my2 = (y2 + y3) / 2;
    if(y2 - y3 == 0) M2 = 0;
    else  M2 = (-1)*(x2 - x3) / (y2 -y3);
    

    if(M1 == M2){
      px = mx1;
      py = my2;
    }
    else if(M1 != M2){
      px = (M1*mx1 - my1 - M2*mx2 + my2) / (M1 - M2);
      py = M1*(px - mx1) + my1;
    }

    r = sqrt((x1 - px)*(x1 - px) + (y1 - py)*(y1 - py));

    printf("%.3f %.3f %.3f\n",px,py,r);
    n--;
  }
 return 0; 
}