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 <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];
	}
	for(int i = 0; i < n; i++){
		solve(x1[i], y1[i], x2[i], y2[i], x3[i], y3[i]);
	}
}

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

using namespace std;

struct point {
	double x, y;
}A, B, C;

struct circle {
	double r;
	point cen;
}cir;

void solve(point A, point B, point C) {
	double tmp1 = A.x * A.x - B.x * B.x + A.y * A.y - B.y * B.y;
	double tmp2 = A.x * A.x - C.x * C.x + A.y * A.y - C.y * C.y;
	cir.cen.x = (tmp1 * (A.y - C.y) - tmp2 * (A.y - B.y)) / (2 * (A.y - C.y) * (A.x - B.x) - 2 * (A.y - B.y) * (A.x - C.x));
	cir.cen.y = (tmp1 * (A.x - C.x) - tmp2 * (A.x - B.x)) / (2 * (A.y - B.y) * (A.x - C.x) - 2 * (A.y - C.y) * (A.x - B.x));
	double la = sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
	double lb = sqrt((B.x - C.x) * (B.x - C.x) + (B.y - C.y) * (B.y - C.y));
	double lc = sqrt((C.x - A.x) * (C.x - A.x) + (C.y - A.y) * (C.y - A.y));
	double p = (la + lb + lc) / 2.0;
	double s = sqrt(p * (p - la) * (p - lb) * (p - lc));
	cir.r = la * lb * lc / (4 * s);
}

int main() {
	int t;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y);
		solve(A, B, C);
		printf ("%.3lf %.3lf %.3lf\n",cir.cen.x, cir.cen.y, cir.r);
	}
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	double x[n], y[n], r[n];
	for(int i = 0; i < n; i++){
		double x1, y1, x2, y2, x3, y3;
		double a, b, c, d, e, f;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a = 2*(x1-x2);
		b = 2*(y1-y2);
		c = 2*(x2-x3);
		d = 2*(y2-y3);
		e = x1*x1-x2*x2+y1*y1-y2*y2;
		f = x2*x2-x3*x3+y2*y2-y3*y3;
		x[i] = (d*e-b*f)/(a*d-b*c);
		y[i] = (a*f-c*e)/(a*d-b*c);
		r[i] = sqrt((x[i]-x1)*(x[i]-x1)+(y[i]-y1)*(y[i]-y1));
		//if((int)floor(r[i]*10000)%10 > 4){
		//	r[i] = r[i] + 0.001;
		//}
	}
	for(int i = 0; i < n; i++){
		cout <<  fixed << setprecision(3) << x[i] << " " << y[i] << " " << r[i] << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>

using namespace std;

int main() {

	int n;
	double x1, x2, x3, y1, y2, y3;
	double X, Y, R;
	double a, b, c, d, e, f;

	cin >> n;

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

		a = -x2 + x3;
		b = -x1*x1 + x2*x2 - y1*y1 + y2*y2;
		c = x1 - x2;
		d = -x2*x2 + x3*x3 - y2*y2 + y3*y3;
		e = -c * 2 * (y2 - y3);
		f = a * 2 * (y1 - y2);

		Y = (a*b + c*d) / (e - f);
		X = (b+2*Y*(y1-y2))/(-2*c);
		R = sqrt((X - x1)*(X - x1) + (Y-y1)*(Y-y1));

		if (X > 0)
			X = (int)(X * 1000 + 0.5) ;
		else X = (int)(X * 1000 - 0.5) ;

		if (Y>0)
			Y = (int)(Y * 1000 + 0.5) ;
		else Y = (int)(Y * 1000 - 0.5) ;

		if (R > 0)
			R = (int)(R * 1000 + 0.5);
		else R = (int)(R * 1000 - 0.5);

		printf("%.3f %.3f %.3f\n", X/1000, Y/1000, R/1000);
	}

	return 0;
}

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

#define ROUND_RANK 4
#define EPS 1e-8

using namespace std;

struct vec2
{
	double x;
	double y;
};

//行列式の算出
double Calc_det(const double& p11, const double& p12, const double& p21, const double& p22) {
	return (p11*p22 - p12*p21);
}
//xの解の算出
double Calc_x(const double& det, const double& q1, const double& p22, const double& p12, const double& q2) {
	return ((q1*p22 - p12*q2) / det);
}
//yの解の算出
double Calc_y(const double& det, const double& p11, const double& q2, const double& q1, const double& p21) {
	return ((p11*q2 - q1*p21) / det);
}
//rの解の算出
double Calc_r(const double& x0, const double& y0, const double& x1, const double& y1) {
	double r;
	r = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
	return r;
}
//少数点以下第rank位で四捨五入
double Round(const double& value, const int& rank) {
	int root = pow(10, rank);
	return (std::round(value*root) / root);
}

int main() {
	int n;
	vec2 ver[20][3];
	double p11, p12, p21, p22, q1, q2;
	double  det;//行列式
	double	x, y, r;//解

	cin >> n;

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> ver[i][j].x;
			cin >> ver[i][j].y;
		}
		p11 = -2 * (ver[i][0].x - ver[i][1].x);
		p12 = -2 * (ver[i][0].y - ver[i][1].y);
		p21 = -2 * (ver[i][1].x - ver[i][2].x);
		p22 = -2 * (ver[i][1].y - ver[i][2].y);
		q1 = (ver[i][1].x + ver[i][0].x)*(ver[i][1].x - ver[i][0].x)
			+ (ver[i][1].y + ver[i][0].y)*(ver[i][1].y - ver[i][0].y);
		q2 = (ver[i][2].x + ver[i][1].x)*(ver[i][2].x - ver[i][1].x)
			+ (ver[i][2].y + ver[i][1].y)*(ver[i][2].y - ver[i][1].y);
		det = Calc_det(p11, p12, p21, p22);
		det = fabs(det);
		x = Calc_x(det, q1, p22, p12, q2);
		y = Calc_y(det, p11, q2, q1, p21);
		r = Calc_r(x, y, ver[i][0].x, ver[i][0].y);
		x = Round(x, ROUND_RANK);
		y = Round(y, ROUND_RANK);
		r = Round(r, ROUND_RANK);
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << x + EPS << " " << y + EPS << " " << r + EPS << endl;
	}
}

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

int main(void)
{
	float x1, x2, x3, y1, y2, y3;
	float xp, yp, r;
	float rs;
	int n;
	
	scanf("%d", &n);
	
	while (n){
		scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
		
		xp = ((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));
		yp = ((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((x1 - xp) * (x1 - xp) + (y1 - yp) * (y1 - yp));
		
		n--;
		
		printf("%.3f %.3f %.3f\n", xp, yp, r);
	}
	
	return (0);
}

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

using namespace std;

typedef complex<double> point;
#define X real()
#define Y imag()
typedef point vec;

double cross(vec a, vec b)
{ return a.X * b.Y - b.X * a.Y; }

double dis(point a, point b)
{ return abs(a - b); }

point center(point A, point B, point C) // Circumcenter
{
	B -= A; C -= A;
	double b = norm(B), c = norm(C), d = 2 * cross(B, C);
	return point(C.Y * b - B.Y * c, B.X * c - C.X * b) / d;
}

int main()
{
	int dat;
	scanf("%d", &dat);
	while (dat--) {
		point p[3], c;
		for (int i = 0; i < 3; ++i) {
			double x, y;
			scanf("%lf%lf", &x, &y);
			p[i] = point(x, y);
		}
		c = center(p[0], p[1], p[2]);
		printf("%.3lf %.3lf %.3lf\n", c.X, c.Y, dis(c, p[0]));
	}
}