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


int main(void){

  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 a = sqrt(pow(x2-x1,2) + pow(y2-y1,2));
    double b = sqrt(pow(x3-x2,2) + pow(y3-y2,2));
    double c = sqrt(pow(x3-x1,2) + pow(y3-y1,2));

    double r = a*b*c / sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));

    double A = pow(x2-x1,2) + pow(y2-y1,2);
    double B = pow(x3-x2,2) + pow(y3-y2,2);
    double C = pow(x3-x1,2) + pow(y3-y1,2);
    double s = (A*(B+C-A) + B*(C+A-B) + C*(A+B-C))/2;


    double x = A*(B+C-A) / s;
    double y = B*(C+A-B) / s;

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

  }




  return 0;
}

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;

double n, r, x1, y1, x2, y2, x3, y3, xa, ya, xb, yb, xc, yc, ma, mb, mc, y_hasil, x_hasil;

int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		ma = (x2-x1)/(y1-y2);
		mb = (x3-x2)/(y2-y3);
		mc = (x3-x1)/(y1-y3);
		xa = (x1+x2)/2;
		ya = (y1+y2)/2;
		xb = (x2+x3)/2;
		yb = (y2+y3)/2;
		xc = (x3+x1)/2;
		yc = (y3+y1)/2;
		
	//	cout << ma << " " << xa << " " << mb << " " << xb << " " << yb << " " << ya << "\n";
		if(y1 - y2 == 0){
			x_hasil = (x2 + x1) / 2;
			y_hasil = mb*(x_hasil - xb) + yb;
		}else if(y2 - y3 == 0){
			x_hasil = (x2 + x3) / 2;
			y_hasil = ma*(x_hasil - xa) + ya;
		}else{
			x_hasil = (ma*xa - mb*xb + yb - ya)/(ma - mb);
			y_hasil = ma*(x_hasil - xa) + ya;
		}
		
		r = sqrt((x_hasil - x1)*(x_hasil - x1) + (y_hasil - y1)*(y_hasil - y1));
		
		cout << fixed << setprecision(3) << x_hasil << " " << y_hasil << " " << r << "\n";
	}
	return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	
	while(n-- > 0){
	
	double x1, y1, x2, y2, x3, y3;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	
	double a = 2 * (x2 - x1);
	double b = 2 * (y2 - y1);
	double c = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
	double d = 2 * (x3 - x2);
	double e = 2 * (y3 - y2);
	double f = x2 * x2 - x3 * x3 + y2 * y2 - y3 * y3;
		
	double cx = (b * f - c * e)/(a * e - d * b);
	double cy = (a * f - c * d)/(b * d - a * e);
		
	double r = sqrt((x1 - cx)*(x1 - cx) + (y1 - cy)*(y1 - cy));
	
	cout << fixed << setprecision(3) << cx << " " << cy << " " << r << endl;
	
	}
	
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double p[3][2],m[2][2],a[2],inv[2][2],o[2],det;
    for(int i=0; i<3; i++) for(int j=0; j<2; j++) cin >>p[i][j];
    for(int i=1; i<3; i++) for(int j=0; j<2; j++) p[i][j]-=p[0][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) m[i][j] = 2*p[i+1][j];
    for(int i=0; i<2; i++) a[i] = p[i+1][0]*p[i+1][0]+p[i+1][1]*p[i+1][1];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    inv[0][0] = m[1][1]/det;
    inv[0][1] = -m[0][1]/det;
    inv[1][0] = -m[1][0]/det;
    inv[1][1] = m[0][0]/det;
    for(int i=0; i<2; i++) o[i] = inv[i][0]*a[0]+inv[i][1]*a[1];
    printf("%.3lf %.3lf %.3lf\n",o[0]+p[0][0],o[1]+p[0][1],sqrt(o[0]*o[0]+o[1]*o[1]));
  }
  return 0;
}

C++: #include<stdio.h>
#include<math.h>
double sisyagonyuu3(double moto){
	if(moto>0){
		return (moto+0.0005)/100*100;
	}else if(moto==0){
		return 0;
	}else{
		return (moto-0.0005)/100*100;
	}
}
int main()
{
	int n;
	double x1[32],x2[32],x3[32],y1[32],y2[32],y3[32],p,q,r,coa,sna;
	double ac,ab,bc;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lf%lf%lf%lf%lf%lf",&x1[i],&x2[i],&x3[i],&y1[i],&y2[i],&y3[i]);
		p=sisyagonyuu3(((y1[i]-y3[i])*(y1[i]*y1[i]-y2[i]*y2[i]+x1[i]*x1[i]-x2[i]*x2[i])-(y1[i]-y2[i])*(y1[i]*y1[i]-y3[i]*y3[i]+x1[i]*x1[i]-x3[i]*x3[i]))/(2*(y1[i]-y3[i])*(x1[i]-x2[i])-2*(y1[i]-y2[i])*(x1[i]-x3[i])));
		q=sisyagonyuu3(((x1[i]-x3[i])*(x1[i]*x1[i]-x2[i]*x2[i]+y1[i]*y1[i]-y2[i]*y2[i])-(x1[i]-x2[i])*(x1[i]*x1[i]-x3[i]*x3[i]+y1[i]*y1[i]-y3[i]*y3[i]))/(2*(x1[i]-x3[i])*(y1[i]-y2[i])-2*(x1[i]-x2[i])*(y1[i]-y3[i])));
		ab=sqrt(fabs((x3[i]-x1[i])*(x3[i]-x1[i])+(y3[i]-y1[i])*(y3[i]-y1[i])));
		ac=sqrt(fabs((x3[i]-x2[i])*(x3[i]-x2[i])+(y3[i]-y2[i])*(y3[i]-y2[i])));
		bc=sqrt(fabs((x2[i]-x1[i])*(x2[i]-x1[i])+(y2[i]-y1[i])*(y2[i]-y1[i])));
		coa=(ac*ac+ab*ab-bc*bc)/(2*ac*ab);
		sna=1-coa*coa;
		r=sisyagonyuu3((bc/sna)/2);
		printf("%.3lf %.3lf %.3lf\n",p,q,r);
	}
	return 0;
}

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

using namespace std;
#define SQR(x) ((x)*(x))

int main(void) {
    int n;
    cin >> n;
    while (n--) {
        double x1, x2, x3, y1, y2, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

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

        double l = (c * e - b * f) / (e * a - b * d);
        double m = (d * c - a * f) / (d * b - e * a);

        double n = -1 * (SQR(x1) + SQR(y1) + l * x1 + m * y1);

        cout << fixed << setprecision(3)
             << l / -2 << " "
             << m / -2 << " "
             << sqrt(SQR(l) + SQR(m) - 4 * n) / 2 << endl;
    }
}