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<cmath>

//#include<iostream>
using namespace std;

int main(){
	int n;
	float x1, y1, x2, y2, x3, y3, xp,yp, xq, yq, s1, sr1, s2, sr2;
	float b1, b2, xc, yc, r;
	scanf("%d", &n);
	while(n--){
		scanf("%f%f%f%f%f%f",&x1, &y1, &x2, &y2, &x3, &y3);

		if(!(y2-y1)){ 
			r=x1; x1=x3; x3=r; r=y1; y1=y3; y3=r;
		}
		xp=(x2+x1)/2; yp=(y2+y1)/2;
		xq=(x3+x1)/2; yq=(y3+y1)/2;
		sr1=-(x2-x1)/(y2-y1); b1=yp-sr1*xp;
		sr2=-(x3-x1)/(y3-y1); b2=yq-sr2*xq;

		xc=-(b1-b2)/(sr1-sr2);
		yc=sr1*xc+b1;
		r=sqrt((xc-x1)*(xc-x1)+(yc-y1)*(yc-y1));
		printf("%.3f %.3f %.3f\n",xc+.0005, yc+.0005, r+.0005);
	}
	return 0;
}

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

// _ÀWð^Æ·é
typedef complex<double> P;
// ÎÌè`
#define PI 3.1415926535898

// e·éë·Ã
#define EPS (1e-10)
//XYÀW
#define X real()
#define Y imag()
	
// Op`NX
class Triangle{

private:
	//Op`ÌR_ÌÀW
	P a, b, c;
	//Op`ÌRÓÌ·³
	double edgeA,edgeB,edgeC;
	//Op`ÌRpÌå«³(WA)
	double angleA,angleB,angleC;
	//]·è©çRÂÌpxðßéÖ
	double LawOfCosines(double a,double b, double c){
		return acos( (b*b+c*c-a*a) / (2.0*b*c) );
	}
	//QÂÌdouble^Ìlªµ¢©Ç¤©
	bool equal(double a, double b){
		return (fabs( a-b ) < EPS)? true : false ;
	}

public:
	//RXgN^(RÂÌ_ÆÓÆpxðú»)
	Triangle(P p1, P p2, P p3){
		a = p1;
		b = p2;
		c = p3;
		edgeB = abs(c-a);
		edgeA = abs(b-c);
		edgeC = abs(a-b);
		angleA = LawOfCosines(edgeA,edgeB,edgeC);
		angleB = LawOfCosines(edgeB,edgeC,edgeA);
		angleC = LawOfCosines(edgeC,edgeA,edgeB);
	}
	
	double circumscribedCircleRadius(){//OÚ~Ì¼aðÔ·
		return ( edgeA / sin(angleA) / 2.0 );
	}
	double circumscribedCircleX(){//OS(OÚ~ÌS)ÌXÀWðÔ·
		double A = sin(2.0*angleA);
		double B = sin(2.0*angleB);
		double C = sin(2.0*angleC);
		return ( (a.X * A + b.X * B + c.X * C) / (A+B+C) );
	}
	double circumscribedCircleY(){//OS(OÚ~ÌS)ÌYÀWðÔ·
		double A = sin(2.0*angleA);
		double B = sin(2.0*angleB);
		double C = sin(2.0*angleC);
		return ( (a.Y * A + b.Y * B + c.Y * C) / (A+B+C) );
	}
};

int main(){
	int n;
	double x1, x2, x3, y1, y2, y3;
	double r, xp, yp;

	scanf("%d", &n);
	for (int i=0 ; i<n ; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
		P a( x1 , y1 );
		P b( x2 , y2 );
		P c( x3 , y3 );
		Triangle Tr(a,b,c);
		r  = Tr.circumscribedCircleRadius();
		xp = Tr.circumscribedCircleX();
		yp = Tr.circumscribedCircleY();
		printf("%.3f %.3f %.3f\n", xp,yp,r);
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
 
int main()
{
    int n;
 
    std::cin >> n;
 
    double x1,y1,x2,y2,x3,y3,xp,yp,r;
 
    for(int i=0;i<n;++i)
    {
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
 
        xp = 1.0*((x1*x1+y1*y1)*(y2-y3)+(x2*x2+y2*y2)*(y3-y1)+(x3*x3+y3*y3)*(y1-y2))/(2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)));
 
        yp = 1.0*((x1*x1+y1*y1)*(x2-x3)+(x2*x2+y2*y2)*(x3-x1)+(x3*x3+y3*y3)*(x1-x2))/(2*(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2)));
 
        double a = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
 
        double b = sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
 
        double c = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
 
        r = a*b*c/(sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c)));
 
        printf("%.3f %.3f %.3f\n",xp,yp,r) ;
    }
}

C++: #include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define SQ(i) ((i) * (i))
using namespace std;

int main(){
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2, x, y, a, b, c, cos_a, sin_a, r;
  int n, tmp;
  scanf("%d", &n);
  while(n--){
    scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
    a1 = 2 * (x2 - x1); a2 = 2 * (x3 - x1);
    b1 = 2 * (y2 - y1); b2 = 2 * (y3 - y1);
    c1 = SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2);
    c2 = SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3);
    x = (b1 * c1 - b2 * c1) / (a1 * b2 - a2 * b1);
    y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    r = sqrt((x-x1) + (y - y1));
    r *= 1000;
    r += 0.5;
    tmp = r;
    r = tmp;
    r /= 1000;
    printf("%.3f %.3f %.3f\n",x, y, r);
  }
  return 0;
}

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

class Triangle{

public:
	double a, b, c;
	double cosA, sinA,R,px,py;

	//con???????§???¢???????????§?¨?????±???????????¬?????¨????????¨????????¨?????°???\???????????????????????£?????????
	double con1, con2, con3,con4,con5,con6;


	Triangle(double x1,double y1,double x2,double y2,double x3,double y3);

	double Radius();
	double Px();
	double Py();

};


//Triangle????????????????????????
Triangle::Triangle(double x1, double y1, double x2, double y2, double x3, double y3){

	a = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
	b = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1));
	c = sqrt((x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3));

	
	cosA = ((b*b) + (c*c) - (a*a)) / (2 * b*c);
	sinA = sqrt(1 - (cosA*cosA));

	R = a / (2 * sinA);

	//????????¬?????????????????§?¨?????±???????
	con1 = (y3 - y2)*(x1*x1) - (y3 - y1)*(x2*x2) + (y2-y1)*(x3*x3);
	con2 = (y3 - y1)*x2 - (y2 - y1)*x3 + (y2 - y3)*x1;
	con3 = (y1*y1)*(y3 - y2) + (y2*y2)*(y1 - y3) + (y3*y3)*(y2 - y1);

	//????????????con1+2px*con2+con3=0??¨??????
	px = (con3 - con1) / (2 * con2);


	con4 = (x3 - x2)*(y1*y1) - (x3 - x1)*(y2*y2) + (x2 - x1)*(y3*y3);
	con5 = (x3 - x1)*y2 - (x2 - x1)*y3 + (x2 - x3)*y1;
	con6 = (x1*x1)*(x3 - x2) + (x2*x2)*(x1 - x3) + (x3*x3)*(x2 - x1);

	py = (con6 - con4) / (2 * con5);


}


//?????\????????????Radius????±?????????¢??°
double Triangle::Radius(){

	R=round(R*1000)/1000;
	return R;
}

//px???????????¢??°
double Triangle::Px(){

	px = floor(px*1000)/1000;
	return px;
}

//py???????????¢??°
double Triangle::Py(){

	py = floor(py*1000) / 1000;
	return py;
}



//??£??????????????¨???????§£???
int main(void){


	int n;
	double x1, x2, x3, y1, y2, y3;
	cin >> n;

	for (int i = 0; i < n; i++){
	
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	
		//????§???¢??????????????????????????§???????????????
		Triangle Triangle(x1, y1, x2, y2, x3, y3);
		
		printf("%.3f ", Triangle.Px());
		printf("%.3f ", Triangle.Py());
		printf("%.3f\n",Triangle.Radius());


	}


	return 0;
}

C++: #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef double D;
typedef complex<D> P;
typedef vector<P> VP;
P minEnclosingCircle(const VP& ps) {
  P c;
  double move = 0.5;
  r(i,39) {  // 2^(-39-1) \approx 0.9e-12
    r(t,50) {
      D max = 0;
      int k = 0;
      r (j, ps.size()) if (max < norm(ps[j]-c)) {
        max = norm(ps[j]-c);
        k = j;
      }
      c += (ps[k]-c) * move;
    }
    move /= 2;
  }
  return c;
}
int main(){
    int n;
    cin>>n;
    r(i,n){
        VP p;
        D a,b;
        r(j,2){
            cin>>a>>b;
            p.push_back(P(a,b));
        }
        P t=minEnclosingCircle(p);
        D dis=max(norm(p[0]-t),max(norm(p[1]-t),norm(p[2]-t)));
        printf("%.3f %.3f %.3f\n",t.real(),t.imag(),dis);
    }
}