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<cstdio>
using namespace std;

int main()
{
    int n;
    int x1,x2,x3,y1,y2,y3;
    cin>>n;
    while(n--)
    {
        double x,y,r,dx,dy;
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        dx=(x2+x3-2*x1)/2;
        dy=(y2+y3-2*y1)/2;
        x=x1+dx;
        y=y1+dy;
        r=sqrt(dx*dx+dy*dy);
        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 <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main() {
	int num;
	double x1,y1,x2,y2,x3,y3,px,py,r;
	cin>>num;
	while(num--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		px=((y1-y3)*(y1*y1 -y2*y2 +x1*x1 -x2*x2) -(y1-y2)*(y1*y1 -y3*y3 +x1*x1 -x3*x3)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
		py=((x1-x3)*(x1*x1 -x2*x2 +y1*y1 -y2*y2) -(x1-x2)*(x1*x1 -x3*x3 +y1*y1 -y3*y3)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
		r=sqrt(pow((x1-px),2.0)+pow((y1-py),2.0));
		printf("%.3f %.3f %.3f",px,py,r);
	}	
	return 0;
}

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

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

void solve(double x1, double y1, double x2, double y2, double x3, double y3){
	double a,b,c,ans_x,ans_y,ans_r;
	a = l(x1, y1, x2, y2);
	b = l(x1, y1, x3, y3);
	c = l(x2, y2, x3, y3);
	double A,B,C;
	A=a*a;
	B=b*b;
	C=c*c;
	
	ans_x = A*(B+C-A)*x1 + B*(C+A-B)*x2 + C*(A+B-C)*x3;
	ans_y = A*(B+C-A)*y1 + B*(C+A-B)*y2 + C*(A+B-C)*y3;
	double div = A*(B+C-A) + B*(C+A-B) + C*(A+B-C);
	ans_x/=div;
	ans_y/=div;
	ans_r = l(x1, y1, ans_x, ans_y);
	printf("%4.3f %4.3f, %4.3f\n",ans_x, ans_y, ans_r);
}

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

C++: #include <iostream>
#include <vector>
#include <math.h>

#define POW(X) (X)*(X)

using namespace std;

int main(){
  double x1,y1,x2,y2,x3,y3;
  vector<double> x1l,y1l,x2l,y2l,x3l,y3l;
  int n;

  cin >> n;

  for(int i=0; i<n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    x1l.push_back(x1);
    y1l.push_back(y1);
    x2l.push_back(x2);
    y2l.push_back(y2);
    x3l.push_back(x3);
    y3l.push_back(y3);
  }

  double ex,ey,fx,fy;
  double a,b,c,d,e,f,r;

  for(int i=0; i<n; i++){
    x1=x1l[i];
    y1=y1l[i];
    x2=x2l[i];
    y2=y2l[i];
    x3=x3l[i];
    y3=y3l[i];

    a = -((y2-y1)*POW(y3)+(-POW(y2)+POW(y1)-POW(x2)+POW(x1))*y3+y1*POW(y2)+(-POW(y1)+POW(x3)-POW(x1))*y2+(POW(x2)-POW(x3))*y1)/((2*x2-2*x1)*y3+(2*x1-2*x3)*y2+(2*x3-2*x2)*y1);
    b =  ((x2-x1)*POW(y3)+(x1-x3)*POW(y2)+(x3-x2)*POW(y1)+(x2-x1)*POW(x3)+(POW(x1)-POW(x2))*x3+x1*POW(x2)-POW(x1)*x2)/((2*x2-2*x1)*y3+(2*x1-2*x3)*y2+(2*x3-2*x2)*y1);
    r = sqrt((a-x1)*(a-x1) + (b-y1)*(b-y1));
    printf("%0.3f %0.3f %0.3f\n",a,b,r);
  }

  return 0;
}

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

double sisya(double x)
{
	int a = static_cast<int>(x * 10000);
	//x = static_cast<double>(static_cast<int>(x * 1000)) / 1000;
	if(a < 0 && a%10 <= -5)
		return x-0.001;
	else if(a%10 >= 5)
		return x+0.001;
	return x;
}

double dif(double x,double y,double xx, double yy)
{
	return sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy));
}

int main()
{
	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;
		double px = sisya(max(x1,max(x2,x3)) - (max(x1,max(x2,x3)) - min(x1,min(x2,x3))) / 2 );
		double py = sisya(max(y1,max(y2,y3)) - (max(y1,max(y2,y3)) - min(y1,min(y2,y3))) / 2 );
		double r  = sisya(dif(x1,y1,px,py));
		cout << setprecision(3) << fixed << px << " " << setprecision(3) << fixed << py << " " << setprecision(3) << fixed << r <<endl;
	}
	return 0;
}

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

using namespace std;

void gaisetu(double x1,double y1,double x2,double y2,double x3,double y3){
  //center point.and r.
  double a,b,r;
  a = ((y2-y3)*(x1*x1-x2*x2+y1*y1-y2*y2) - (y1-y2)*(x2*x2-x3*x3+y2*y2-y3*y3))
    / (2*((x1-x2)*(y2-y3)-(x2-x3)*(y1-y2)));

  b = ((x2-x3)*(x1*x1-x2*x2+y1*y1-y2*y2) - (x1-x2)*(x2*x2-x3*x3+y2*y2-y3*y3))
    / (2*((y1-y2)*(x2-x3)-(y2-y3)*(x1-x2)));

  r = sqrt((a-x1)*(a-x1) + (b-y1)*(b-y1));

  cout << fixed << setprecision(3) << a << " " <<  b << " " << r <<  endl;
}
int main(){
  //gaisetu(0.0,0.0,2.0,0.0,2.0,2.0);
  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;
    gaisetu(x1,y1,x2,y2,x3,y3);
  }
  return 0;
}