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 <cmath>
#include <iomanip>
using namespace std;

struct TCoordinate
{
	double x;
	double y;
};

struct TInfoCircle
{
	double x;
	double y;
	double r;
};

TInfoCircle GetInfoCircle(const TCoordinate& P1, const TCoordinate& P2, const TCoordinate& P3)
{
	TInfoCircle InfoCircle;
	double x1 = P1.x;
	double x2 = P2.x;
	double x3 = P3.x;
	double y1 = P1.y;
	double y2 = P2.y;
	double y3 = P3.y;
	double x, y, r;
	if(y1 == y2 || y2 == y3 || y3 == y1){
		if(y2 == y3){
			swap(x3, x1);
			swap(y3, y1);
		}else if(y3 == y1){
			swap(x2, x3);
			swap(y2, y3);
		}
		double xa = (x2 + x3) / 2;
		double ya = (y2 + y3) / 2;
		double a  = (-x3 + x2) / (y3 - y2);
		InfoCircle.x = (x1 + x2) / 2;
		InfoCircle.y = a * (x - xa) + ya;
	}else{
		double xa = (x1 + x2) / 2;
		double ya = (y1 + y2) / 2;
		double a  = (-x2 + x1) / (y2 - y1);
		double xb = (x2 + x3) / 2;
		double yb = (y2 + y3) / 2;
		double b  = (-x3 + x2) / (y3 - y2);
		InfoCircle.x = (b * xb - a * xa - yb + ya) / (b - a);
		InfoCircle.y = a * (x - xa) + ya;
	}
	InfoCircle.r = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
	return InfoCircle;
}

TCoordinate GetCenterPoint(const TCoordinate& P1, const TCoordinate& P2, const TCoordinate& P3)
{
//	cout << P1.x << P1.y << P2.x << P2.y << P3.x << P3.y << endl;
	TInfoCircle InfoCircle = GetInfoCircle(P1, P2, P3);
	return {InfoCircle.x, InfoCircle.y};
//	cout << InfoCircle.y << endl;
}

double GetRadius(const TCoordinate& P1, const TCoordinate& P2, const TCoordinate& P3)
{
	TInfoCircle InfoCircle = GetInfoCircle(P1, P2, P3);
	return InfoCircle.r;
}

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		TCoordinate P1, P2, P3;
		cin >> P1.x >> P1.y >> P2.x >> P2.y >> P3.x >> P3.y;
		TCoordinate CenterPoint = GetCenterPoint(P1, P2, P3);
		double Radius = GetRadius(P1, P2, P3);
		cout << fixed << setprecision(3);
		cout << CenterPoint.x << ' ' << CenterPoint.y << ' ' << Radius << endl;
	}
	return 0;
}

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

int main()
{
	int n, t;
	double x1, y1, r1, x2, y2, r2;
	double d;

	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &r1, &x2, &y2, &r2);

		d = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);
		if (d == (r1 + r2)*(r1 + r2) || d == (r2 - r1)*(r2 - r1)) t = 1;
		else if (d < (r2-r1)*(r2-r1)){
			if (r2 < r1) t = 2;
			else if (r2 > r1) t = -2;
		}else if (d >= (r1 + r2)*(r1 + r2)) t = 0;

		printf("%d\n", t);
	}

	return 0;
}

C++: /*Filename: aoj0010.cpp
 *Author: Mushiyo
 */

#include <stdio.h>
#include <iostream>
#include <cmath>

using namespace std;

struct Point {
	double x;
	double y;
};

double countDist(Point p1, Point p2) {
	int xDist = abs(p1.x - p2.x);
	int yDist = abs(p1.y - p2.y);

	return sqrt(xDist * xDist + yDist * yDist);
}

Point getCircumCircleCenter(Point p1, Point p2, Point p3) {
	Point bias = p1;

	// a, b & c for ax + by = c
	double a1 = p2.x - p1.x, b1 = p2.y - p1.y, c1 = (a1 * a1 + b1 * b1) / 2;
	double a2 = p3.x - p1.x, b2 = p3.y - p1.y, c2 = (a2 * a2 + b2 * b2) / 2;
	/* translate the origin to p1
	 * let the center of the circumscribed circle be (x, y)
	 * we can get the value of (x, y) by solve the following simultaneous equations to :
	 * a1 * x + b1 * y = c1 --(1)
	 * a2 * x + b2 * y = c2 --(2)
	 *
	 * 1. after rearrange eq.1, we have:
	 * y = (c1 - a1 * x) / b1
	 * plugging this into eq.2, we have:
	 * x = (b1 * c2 - b2 * c1) / (a2 * b1 - a1 * b2)
	 *
	 * 2. after rearrange eq.1, we have:
	 * x = (c1 - b1 * y) / a1
	 * plugging this into eq.2, we have:
	 * y = (a1 * c2 - a2 * c1) / (a1 * b2 - a2 * b1)
	 *   = (a2 * c1 - a1 * c2) / (a2 * b1 - a1 * b2)
	*/
	double d = a2 * b1 - a1 * b2;
	Point center;
	center.x = bias.x + (b1 * c2 - b2 * c1) / d;
	center.y = bias.y + (a2 * c1 - a1 * c2) / d;


	return center;
}

int main() {
	int n;

	while (cin >> n) {
		while (n > 0) {
			Point a, b, c;
			cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;

			Point center = getCircumCircleCenter(a, b, c);
			double radius = countDist(center, a);

			printf("%.3f %.3f %.3f\n", center.x, center.y, radius);

			--n;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<math.h>
#include <iomanip>
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 px, py, r;
		double A1, B1, C1, A2, B2, C2;
		A1 = 2 * (x2 - y2);
		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;

		px = (B1*C2 - B2*C1) / (A1*B2 - A2*B1);
		py = (C1*A2 - C2*A1) / (A1*B2 - A2*B1);

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

		px = round(px * 1000) / 1000;
		py = round(py * 1000) / 1000;
		r = round(r * 1000) / 1000;
		cout << fixed << setprecision(3) << px << " ";
		cout << fixed << setprecision(3) << py << " ";
		cout << fixed << setprecision(3) << r << endl;
	}
	return 0;

}