Go: package main

import (
	"fmt"
	"math"
)

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

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

func circleTriangle() {
	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<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>

using namespace std;

typedef long long int lli;

int main() {
	int n;
	double xy[3][3],x,y;
	double a, b, c, d, e, f, radius;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 2; k++) {
				cin >> xy[j][k];
			}
		}
		a = -2 * (xy[0][0]-xy[1][0]);
		b = -2 * (xy[0][1] - xy[1][1]);
		c = -1 * (pow(xy[0][0], 2) + pow(xy[0][1], 2)) + pow(xy[1][0], 2) + pow(xy[1][1], 2);
		d = -2 * (xy[0][0] - xy[2][0]);
		e = -2 * (xy[0][1] - xy[2][1]);
		f = -1 * (pow(xy[0][0], 2) + pow(xy[0][1], 2)) + pow(xy[2][0], 2) + pow(xy[2][1], 2);
		y = (a*f - c*d) / (a*e - b*d);
		x = (c*e - b*f) / (a*e - b*d);
		if (x == 0) x = 0;
		if (y == 0) y = 0;
		radius =abs(sqrt((x-xy[0][0])+(y-xy[0][1])));

		cout << fixed << setprecision(3) << x << " " << y << " "<< radius <<endl;
	}
	return 0;
}

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

using namespace std;
int main(){
  int n;cin >> n;
  double x1,x2,x3,y1,y2,y3,x12,x13,y12,y13,xx12,yy12,xx13,yy13,x,y,r;
  for(int i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    x12 = x1 -x2;
    x13 = x1 -x3;
    y12 = y1-y2;
    y13 = y1 -y3;
    xx12 = x1*x1-x2*x2;
    xx13 = x1*x1-x3*x3;
    yy12 = y1*y1-y2*y2;
    yy13 = y1*y1-y3*y3;

    x=-0.5*(y12*(xx13+yy13)-y13*(xx12+yy12))/(x12*y13-x13*y12);
    y=-0.5*(x12*(xx13+yy13)-x13*(xx12+yy12))/(y12*x13-y13*x12);
    r=sqrt(x*x+y*y+x1*x1+y1*y1-2*x*x1-2*y*y1);
    printf("%.3lf %.3lf %.3lf\n",x,y,r);
   }
   return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
class circle{
    public:
        void solve(double x1,double y1,double x2,double y2,double x3,double y3){
                double left,right,top,bottom,px,py,r;
                left=min(x1,min(x2,x3));
                right=max(x1,min(x2,x3));
                top=max(x1,min(x2,x3));
                bottom=min(x1,min(x2,x3));
                px=(left+right)/2;
                py=(top+bottom)/2;
                r=sqrt(pow(x1-px,2)+pow(y1-py,2));
                printf("%.3lf %.3lf %.3lf\n",px,py,r);
        }
};
int main(){
    circle inst;
    int n;
    double x1,y1,x2,y2,x3,y3;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        inst.solve(x1,y1,x2,y2,x3,y3);
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;
double a, b, c, d, e, f;
double x, y;


void function(){
	if(c/b == f/e){
		x = 0;
		y = c/b;
	}else if(c/a == f/d){
		y = 0;
		x = c/a;
	}else{
		y = (c*d - a*f)/(d*b - a*e);
		x = (c - b*y)/a;
	}
	return;
}


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;

		a = 2*(x2 - x1);
		b = 2*(y2 - y1);
		c = (x2 - x1)*(x1 + x2) + (y2 - y1)*(y1 + y2);

		d = 2*(x3 - x1);
		e = 2*(y3 - y1);
		f = (x3 - x1)*(x3 + x1) + (x3 - x1)*(x1 + x3);

		function();
		double r;
		r = sqrt((x - x1)*(x - x1) + (y - y1)*(y - y1));

		printf("%.3lf %.3lf %.3lf\n",x, y, r);
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>

using namespace std;

double hankei(double z1,double z2,double dx,double dy){
	 
	double r = sqrt((dx - z1)*(dx - z1) + (dy - z2)*(dy - z2));
	return r;
}


int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		
		double x1, y1, x2, y2, x3, y3,px,py;
		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));

		printf("%.3f %.3f %.3f ",floor(px * 1000 + 0.5) / 1000,floor(py * 1000 + 0.5) / 1000 ,floor(hankei(x1, y1, px, py) * 1000 + 0.5) / 1000);
	}
	
	return 0;
}

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

int main(){
    int n;
    double x1, y1, x2, y2, x3, y3, det2, A, B, X, Y, R;
    scanf("%d", &n);
    while(n--){
        scanf("%lf %lf %lf %lf %lf %lf",
               &x1, &y1, &x2, &y2, &x3, &y3);
        det2 = 2*((x1-x2)*(y1-y3)-(y1-y2)*(x1-x3));
        A = x1*x1-x2*x2+y1*y1-y2*y2;
        B = x1*x1-x3*x3+y1*y1-y3*y3;
        X = ((y1-y3)*A-(y1-y2)*B)/det2;
        Y = ((x1-x2)*B-(x1-x3)*A)/det2;
        R = sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1));
        printf("%.3lf %.3lf %.3lf\n", 
                X, Y, R);
    }
    return 0;
}

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

#define SQ(x) ((x)*(x))

using namespace std;

int main(void)
{
	int n = 0;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		double x1 = 0.0, y1 = 0.0;
		double x2 = 0.0, y2 = 0.0;
		double x3 = 0.0, y3 = 0.0;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		
		double a = x1 - x2;
		double b = y1 - y2;
		double c = SQ(x2) + SQ(y2) - SQ(x1) - SQ(y1);
		double d = x2 - x3;
		double e = y2 - y3;
		double f = SQ(x3) + SQ(y3) - SQ(x2) - SQ(y2);
		
		double l = (c * e - b * f) / (a * e - b * d);
		double m = (a * f - c * d) / (a * e - b * d);
		double n = -1.0 * (SQ(x1) + SQ(y1) + l * x1 + m * y1);
		
		double centerX = l / -2.0;
		double centerY = m / -2.0;
		double radius = sqrt( SQ(l) / 4.0 + SQ(m) / 4.0 - n );
		
		cout.precision(3);
		cout << fixed << centerX << " " << centerY << " " << radius << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>

using namespace std;

typedef long long int lli;

int main() {
	int n;
	double xy[3][3],x,y;
	double a, b, c, d, e, f, radius;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 2; k++) {
				cin >> xy[j][k];
			}
		}
		a = -2 * (xy[0][0]-xy[1][0]);
		b = -2 * (xy[0][1] - xy[1][1]);
		c = -1 * (pow(xy[0][0], 2) + pow(xy[0][1], 2)) + pow(xy[1][0], 2) + pow(xy[1][1], 2);
		d = -2 * (xy[0][0] - xy[2][0]);
		e = -2 * (xy[0][1] - xy[2][1]);
		f = -1 * (pow(xy[0][0], 2) + pow(xy[0][1], 2)) + pow(xy[2][0], 2) + pow(xy[2][1], 2);
		y = (a*f - c*d) / (a*e - b*d);
		x = (c*e - b*f) / (a*e - b*d);
		if (x == 0) x = 0;
		if (y == 0) y = 0;
		radius =sqrt(pow((x-xy[0][0]),2)+pow((y-xy[0][1]),2));

		cout << fixed << setprecision(3) << x << " " << y << " "<< radius <<endl;
	}
	return 0;
}