Go: package main

import (
	"fmt"
	"math"
)

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

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

func cal() {
	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 <bits/stdc++.h>
#include <vector>
using namespace std;

double n, r, x1, y4, x2, y2, x3, y3, xa, ya, xb, yb, xc, yc, ma, mb, mc, y_hasil, x_hasil;

int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x1 >> y4 >> x2 >> y2 >> x3 >> y3;
		ma = (x2-x1)/(y4-y2);
		mb = (x3-x2)/(y2-y3);
		mc = (x3-x1)/(y4-y3);
		xa = (x1+x2)/2;
		ya = (y4+y2)/2;
		xb = (x2+x3)/2;
		yb = (y2+y3)/2;
		xc = (x3+x1)/2;
		yc = (y3+y4)/2;
		
	//	cout << ma << " " << xa << " " << mb << " " << xb << " " << yb << " " << ya << "\n";
		if(y4 - y2 == 0){
			x_hasil = (x2 + x1) / 2;
			y_hasil = mb*(x_hasil - xb) + yb;
		}else if(y2 - y3 == 0){
			x_hasil = (x2 + x3) / 2;
			y_hasil = ma*(x_hasil - xa) + ya;
		}else{
			x_hasil = (ma*xa - mb*xb + yb - ya)/(ma - mb);
			y_hasil = ma*(x_hasil - xa) + ya;
		}
		
		r = sqrt((x_hasil - x1)*(x_hasil - x1) + (y_hasil - y4)*(y_hasil - y4));
		
		cout << fixed << setprecision(3) << x_hasil << " " << y_hasil << " " << r << "\n";
	}
	return 0;
}

C++: #include<iostream>                                                     
#include<cmath>                                                       
#include<cstdio>                                                       
using namespace std;                                                   
                                                                       
int main() {                                                           
  int n;                                                               
  double x1, y1, x2, y2, x3, y3;                                       
  double x, y, r;                                                      
  double a1, a2, b1, b2, c1, c2;                                       
                                                                       
  cin >> n;                                                            
  while (n--) {                                                        
    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 = hypot(x-x1,y-y1);                                              
                                                                       
    printf("%.3f %.3f %.3f\n", x, y, r);                               
  }                                                                    
                                                                       
  return 0;                                                            
}

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

double get_angle( double x1, double y1, double x2, double y2 )
{
	double angle;
	double m;
	if ( x1 == x2 ) angle = 90.0;
	else
	{
		m = ( y2 - y1 ) / ( x2 - x1 );
		angle = atan( m ) * 180.0 / M_PI;
	}
	return angle;
}

double get_radian( double x1, double y1, double x2, double y2 )
{
	if ( x1 == x2 ) return M_PI / 180.0;
	return atan( ( y2 - y1 ) / ( x2 - x1 ) );
}

double get_distance( double x1, double y1, double x2, double y2 )
{
	return sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) );
}

int main( void )
{
	int n; cin >> n;
	
	double x1, y1, x2, y2, x3, y3;
	for ( int i = 0; i < n; i++ )
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		double x12 = ( x1 + x2 ) / 2.0;
		double y12 = ( y1 + y2 ) / 2.0;
		double a12 = get_angle( x1, y1, x2, y2 ) - 90.0;
		double x13 = ( x1 + x3 ) / 2.0;
		double y13 = ( y1 + y3 ) / 2.0;
		double a13 = get_angle( x1, y1, x3, y3 ) - 90.0;

		double t12 = tan( a12 * M_PI / 180.0 );
		double t13 = tan( a13 * M_PI / 180.0 );
		double x = ( t12 * x12 - t13 * x13 + y13 - y12 ) / ( t12 - t13 );
		double y = t13 * ( x - x13 ) + y13;
		double r = get_distance( x1, y1, x, y );

		cout.setf( ios::fixed );
		cout.precision( 3 );
		cout << x << " " << y << " " << r << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef complex<double> P;

double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
P outcircle(P a,P b,P c){
  return (norm(b-c)*(norm(c-a)+norm(a-b)-norm(b-c))*a+
	  norm(c-a)*(norm(a-b)+norm(b-c)-norm(c-a))*b+
	  norm(a-b)*(norm(b-c)+norm(c-a)-norm(a-b))*c)/(P)(4*cross(b-a,c-a)*cross(b-a,c-a));
}

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3;
  P a,b,c;
  cin>>n;
  for(;n>0;n--){
    cin >>x1 >>y1 >>x2 >>y2 >>x3 >>y3;
    P a=P(x1,y1);
    P b=P(x2,y2);
    P c=P(x3,y3);
    P q = outcircle(a,b,c);
    printf("%.3f %.3f %.3f\n",q.real(),q.imag(),abs(a-q));
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    double x1, y1, x2, y2, x3, y3, xm1, ym1, xm2, ym2, xc, yc;
    cin >> n;
    while(n--){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        xm1=(x1+x2)/2.0;
        ym1=(y1+y2)/2.0;
        xm2=(x1+x3)/2.0;
        ym2=(y1+y3)/2.0;
        //cout << xm1 << " "<< ym1 << " " << xm2 << " " << ym2 <<"\n";
        if(y2==y1 && y3!=y1){
            double a2=-(x3-x1)/(y3-y1);
            xc=xm1;
            yc=a2*(xc-xm2)+ym2;
            double r=sqrt((x1-xc)*(x1-xc)+(y1-yc)*(y1-yc));
            printf("%.3f %.3f %.3f\n", xc, yc, r);
        }
        else if(y2!=y1 && y3==y1){
            double a1=-(x2-x1)/(y2-y1);
            xc=xm2;
            yc=a1*(xc-xm1)+ym1;
            double r=sqrt((x1-xc)*(x1-xc)+(y1-yc)*(y1-yc));
            printf("%.3f %.3f %.3f\n", xc, yc, r);
        }
        else{
            double a1=-(x2-x1)/(y2-y1);
            double a2=-(x3-x1)/(y3-y1);
            xc=(a1*xm1-a2*xm2-ym1+ym2)/(a1-a2);
            yc=a1*(xc-xm1)+ym1;
            double r=sqrt((x1-xc)*(x1-xc)+(y1-yc)*(y1-yc));
            printf("%.3f %.3f %.3f\n", xc, yc, r);
        }
    }
    
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int n;
double x[4],y[4],r;

int main(){
	cin >> n;
	while(n--){
		for(int i=0;i<3;i++){
			cin >> x[i] >> y[i];
		}
		if(2*(y[2]-y[0])*(x[1]-x[0])==(y[1]-y[0])*(x[2]-x[0])){
			double z=x[0];
			x[0]=x[2];
			x[2]=z;
			z=y[0];
			y[0]=y[2];
			y[2]=z;
		}
		x[3]=((y[2]-y[1])*(x[1]-x[0])*(x[2]-x[0])-(y[1]-y[0])*(x[1]+x[0])*(x[2]-x[0])+(y[2]-y[0])*(x[1]-x[0])*(x[2]+x[0]))/(2*(y[2]-y[0])*(x[1]-x[0])-(y[1]-y[0])*(x[2]-x[0]));
		if(x[0]==x[1]){
			double z=x[0];
			x[0]=x[2];
			x[2]=z;
			z=y[0];
			y[0]=y[2];
			y[2]=z;
		}
		y[3]=(y[0]+y[1])/2-(y[1]-y[0])*(x[3]-(x[0]+x[1])/2)/(x[1]-x[0]);
		r=sqrt(pow((x[3]-x[2]),2)+pow((y[3]-y[2]),2));
		printf("%.3lf %.3lf %.3lf\n",x[3]+0.00001,y[3]+0.00001,r);
	}
	return 0;
}