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++:  /*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
 */

#include <iostream>
#include <math.h>

using namespace std;

double sqr(double a, double b, double c, double d) {
	// ñÂÌ_Ì£ðßé\bh
	double s = sqrt(pow(max(a,c)-min(a,c), 2) + pow(max(b,d)-min(b,d), 2));
	return s;
}

void solve(double a, double b, double c, double d, double e, double f) {
	double px,py,r;
	// ¼ñªüñÂÌð_ y-y1 = y2-y1 / x2-x1 * x-x1 -> y2-y1=a, x2-x1=b, y = a/b*x - a/b*x1-y1 -> y = -b/a*x + c
	double sl1 = -1*(c-a)/(d-b);			// (x1, y1)-(x2, y2)Ì¼ñªüÌX«
	double sl2 = -1*(e-c)/(f-d);			// (x2, y2)-(x3, y3)Ì¼ñªüÌX«
	double mid1x = (a+c)/2; double mid1y = (b+d)/2;
	double mid2x = (c+e)/2; double mid2y = (d+f)/2;
	double t1 = mid1y-sl1*mid1x;
	double t2 = mid2y-sl2*mid2x;
	// y = sl1*x - t1 Æ y = sl2*x - t2 ðA§B -> sl1*x - t1 = sl2*x - t2 -> (sl1-sl2)*x = t1 - t2
	px = (t1-t2)/(sl1-sl2);
	py = sl1*px - t1;
	r = sqr(px,py,a,b);
	printf("%4.3f %4.3f %4.3f",px,py,r);
}

int main() {
	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;
		solve(x1,y1,x2,y2,x3,y3);
	}
	return 0;
}

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

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

int main(void)
{
    int s;
    int i;
    double x1, x2, x3;
    double y1, y2, y3;
    double a, b, c, d, e, f;
    double l, m, n;
    
    scanf("%d", &s);
    for (i = 0; i < s; i++){
        scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
        
        a = (x1 - x2);
        b = (y1 - y2);
        c = -1 * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2));
        d = (x1 - x3);
        e = (y1 - y3);
        f = -1 * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3));
        
        l = (c * e - b * f) / (e * a - b * d);
        m = (d * c - a * f) / (d * b - e * a);
        
        n = -1 * (SQ(x1) + SQ(y1) + l * x1 + m * y1);
        
        printf("%.3f %.3f %.3f\n", l / -2.0, m / -2.0, sqrt(SQ(l) + SQ(m) - 4 * n) / 2.0);
    }
    
    return (0);
}

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

int main(){

  double x[3], y[3], mx, my, lx, ly, dm, dl, cx, cy, r;
  
  for(int i=0; i<3; i++){
    cin >> x[i] >> y[i];
  }
  
  mx = (x1 + x2) / 2;
  my = (y1 + y2) / 2;
  dm = (y1 - y2) / (x1 - y2);
  lx = (x2 + x3) / 2;
  ly = (y2 + y3) / 2;
  dl = (y2 - y3) / (x2 - x3);
  cx = (my + dm * mx) - (ly + dl * lx);
  cy = (ly + dl * lx) * dm - (my + dm * mx) * dl;
  
  r = sqrt((x1 - cx) * (x1 - cx) + (y1 - cy) * (y1 - cy));

  cx = round(cx * 1000) / 1000;
  cy = round(cy * 1000) / 1000;
  r = round(r * 1000) / 1000;

  printf("%.3f %.3f %.3f\n", cx, cy, r);

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int n; double a, b, c, d, e, f;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> b >> c >> d >> e >> f; double C = sqrt((a - c)*(a - c) + (b - d)*(b - d));
		double B = sqrt((a - e)*(a - e) + (b - f)*(b - f)), A = sqrt((c - e)*(c - e) + (d - f)*(d - f));
		double A1 = 2 * (c - a), B1 = 2 * (d - b), A2 = 2 * (e - a), B2 = 2 * (f - b), C1 = a*a - c*c + b*b - d*d, C2 = a*a - e*e + b*b - f*f;
		double X = (B1*C2 - B2*C1) / (A1*B2 - A2*B1), Y = (C1*A2 - C2*A1) / (A1*B2 - A2*B1);
		double R = (A*B*C) / sqrt((A + B + C)*(-A + B + C)*(A - B + C)*(A + B - C));
		printf("%.3lf %.3lf %.3lf\n", X, Y, R);
	}
	return 0;
}

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

struct Zahyou
{
	float x, y;
};

int main()
{
	int n;
	Zahyou de[4];

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		for (int j = 1; j < 4; j++)
		{
			scanf("%f %f", &de[j].x, &de[j].y);
		}
		de[0].x = ((de[1].y - de[3].y)*(pow(de[1].y, 2) - pow(de[2].y, 2) + pow(de[1].x, 2) - pow(de[2].x, 2)) - (de[1].y - de[2].y)*(pow(de[1].y, 2) - pow(de[3].y, 2) + pow(de[1].x, 2) - pow(de[3].x, 2))) / (2 * (de[1].y - de[3].y)*(de[1].x - de[2].x) - 2 * (de[1].y - de[2].y)*(de[1].x - de[3].x));
		de[0].y = ((de[1].x - de[3].x)*(pow(de[1].x, 2) - pow(de[2].x, 2) + pow(de[1].y, 2) - pow(de[2].y, 2)) - (de[1].x - de[2].y)*(pow(de[1].x, 2) - pow(de[3].x, 2) + pow(de[1].y, 2) - pow(de[3].y, 2))) / (2 * (de[1].x - de[3].x)*(de[1].y - de[2].y) - 2 * (de[1].x - de[2].x)*(de[1].y - de[3].y));
		
		printf("%.3f %.3f %.3f\n",de[0].x,de[0].y,sqrt(de[0].x+de[0].y));
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>
#include <cstdio>
using namespace std;
int main()
{
    int n;
    double ax,ay,bx,by,cx,cy,x,y,r;
    double A1,B1,C1,A2,B2,C2;
    cin>>n;
    while(n--){
        cin>>ax>>ay>>bx>>by>>cx>>cy;
        A1=2*(bx-ax);
        B1=2*(by-ay);
        C1=ax*ax-bx*bx+ay*ay-by*by;
        A2=2*(cx-ax);
        B2=2*(cy-ay);
        C2=ax*ax-cx*cx+ay*ay-cy*cy;
        x=(B1*C2-B2*C1)/(A1*B2-A2*B1);
        y=(C1*A2-C2*A1)/(A1*B2-A2*B1);
        r=sqrt((ax-x)*(ax-x)+(ay-y)*(ay-y));
        printf("%.3f %.3f %.3f\n",x,y,r);
    }
    return 0;
}