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 <vector>
//#include <math.h>
//#include <string>
#include <cmath>
#include <iomanip>

int main();
double round(double dSrc, int iLen);

int main(){
	int cnt = 0;		//データセットの個数
	double x1, y1, x2, y2, x3, y3;
	std::vector<double> p;		//外接円の中心のx座標
	std::vector<double> q;		//外接円の中心のy座標
	std::vector<double> r;		//外接円の半径
	
	std::cin >> cnt;
	for (int i = 0; i < cnt; i++){
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		p.push_back(((y1 - y3) * (pow(y1, 2) - pow(y2, 2) + pow(x1, 2) - pow(x2, 2)) - (y1 - y2) * (pow(y1, 2) - pow(y3, 2) + pow(x1, 2) - pow(x3, 2))) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3)));
		q.push_back(((x1 - x3) * (pow(x1, 2) - pow(x2, 2) + pow(y1, 2) - pow(y2, 2)) - (x1 - x2) * (pow(x1, 2) - pow(x3, 2) + pow(y1, 2) - pow(y3, 2))) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3)));
		r.push_back(sqrt((pow((p[i] - x1), 2) + pow((q[i] - y1), 2))));
		
		/*
		int temp = p[i];
		if (p[i] - temp != 0){
			p[i] = round(p[i], 3);
		}

		temp = q[i];
		if (q[i] - temp != 0){
			q[i] = round(q[i], 3);
		}
		
		temp = r[i];
		if (r[i] - temp != 0){
			r[i] = round(r[i], 3);
		}

		std::cout << std::fixed << std::setprecision(3) << p[i] << " " << q[i] << " " << r[i] << std::endl;
		*/
	}
	
	for (int i = 0; i < cnt; i++){
		int temp = p[i];
		if (p[i] - temp != 0){
			p[i] = round(p[i], 3);
		}

		temp = q[i];
		if (q[i] - temp != 0){
			q[i] = round(q[i], 3);
		}
		
		temp = r[i];
		if (r[i] - temp != 0){
			r[i] = round(r[i], 3);
		}

		std::cout << std::fixed << std::setprecision(3) << p[i] << " " << q[i] << " " << r[i] << std::endl;
	}
	

	//while (1);
	return 0;
}

/**
* 指定桁で四捨五入を行う
* args:数値, 四捨五入する桁数
* return:結果
* 参考:http://oresi.hatenablog.com/entry/2014/06/23/【C%2CC%2B%2B】指定桁数で端数処理%EF%BC%88切り上げ、切り下げ
*/
double round(double dSrc, int iLen)
{
	double	dRet;

	dRet = dSrc * pow(10.0, iLen);
	dRet = (double)(int)(dRet + 0.5);

	return dRet * pow(10.0, -iLen);
}

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

using namespace std;

inline double SQ (double d) {
    return d * d;
}

int main (void) {
    int n;
    double x1, x2, x3, y1, y2, y3;
    cin >> n;
    while (n--) {
        cin >> x1; cin >> y1;
        cin >> x2; cin >> y2;
        cin >> x3; cin >> y3;
        double x, y;
        x = ((y1 - y2) * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3)) -
             (y1 - y3) * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2))) /
            (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3));
        y = ((x1 - x2) * (SQ(y1) - SQ(y3) + SQ(x1) - SQ(x3)) -
             (x1 - x3) * (SQ(y1) - SQ(y2) + SQ(x1) - SQ(x2))) /
            (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3));
        double r = sqrt(SQ(x1- x) + SQ(y1 - y));
        cout << setprecision(3) << fixed << x << ' ' << y << ' ' << r << endl;
    }
    return 0;
}

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(a == 0){
		y = c/b;
		x = (f - c*e/b)/d;
	}else if(b == 0){
		x = c/a;
		y = (f - c*d/a)/e;
	}else if(d == 0){
		y = f/e;
		x = (c - f*b/e)/a;
	}else if(e == 0){
		x = f/d;
		y = (c - a*f/d)/b;
	}else{
		y = (c - a*f/d)/(b - a*e/d);
		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) + (y3 - y1)*(y1 + y3);

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

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

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  for (int i = 0; i < n; i ++) {
    double a, b, c, d, e, f, px, py, r;
    cin >> a >> b >> c >> d >> e >> f;
    py = ((e - a) * (a*a + b*b - c*c - d*d) - (c - a) * (a*a + b*b - e*e - f*f)) / (2 * (e - a) * (b - d) - 2 * (c - a) * (b - f));
    if (c == a) {
      px = (2 * (b - f) * py - a*a - b*b + e*e + f*f) / (2 * (e - a));
    } else {
      px = (2 * (b - d) * py - a*a - b*b + c*c + d*d) / (2 * (c - a));
    }
    r = sqrt((px - a) * (px - a) + (py - b) * (py - b));
    cout << fixed;
    cout << setprecision(3) << px << " " << setprecision(3) << py << " " << setprecision(3) << r << endl;
  }
}

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

void swap(double &x,double &y){
	double t;
	t=x;
	x=y;
	y=t;
}

double cut4(double x){
	double temp=x*1000;
	temp=(temp+0.5)/1000;
	return temp;
}

int main(){
	int n;
	double x1,x2,x3,y1,y2,y3,px,py;
	double a,b,c,d,r;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		if(x1==x2){
			swap(x2,x3);
			swap(y2,y3);
		}else if(x2==x3){
			swap(x1,x2);
			swap(y1,y2);
		}
		a=(y2-y1)/(x2-x1);
		c=(y3-y2)/(x3-x2);
		if(a&&c){
			a=-1/a;
			c=-1/c;
			b=(y1+y2)/2-a*(x1+x2)/2;
			d=(y2+y3)/2-c*(x2+x3)/2;
			px=(b-d)/(c-a);
			py=(b*c-a*d)/(c-a);
		}else if(!a){
			c=-1/c;
			d=(y2+y3)/2-c*(x2+x3)/2;
			px=(x1+x2)/2;
			py=c*(x1+x2)/2+d;
		}else if(!c){
			a=-1/a;
			b=(y1+y2)/2-a*(x1+x2)/2;
			px=(x2+x3)/2;
			py=a*(x2+x3)/2+b;
		}

		r=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
//		px=(px==0?0.000:px);
//		py=(py==0?0.000:py);
		printf("%.3lf %.3lf %.3lf\n",px,py,r);
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>
 
using namespace std;
 
 
int main(){
    int n;
    double x1,x2,x3,y1,y2,y3,ox,oy,r;
    scanf("%d",&n);
 
    for(int i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
        ox=((y2-y1)*((y3*y3-y1*y1)+(x3*x3-x1*x1))-(y3-y1)*((y2*y2-y1*y1)+(x2*x2-x1*x1)))/
                (2*((x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)));
        if(y2 != y1){
            oy=(2*(x1-x2)*ox+(y2*y2-y1*y1)+(x2*x2-x1*x1))/(2*(y2-y1));
        }else{
            oy=(2*(x1-x3)*ox+(y3*y3-y1*y1)+(x3*x3-x1*x1))/(2*(y3-y1));
        }
 
        r = sqrt((ox-x1)*(ox-x1)+(oy-y1)*(oy-y1));
        printf("%.3lf %.3lf %.3lf\n",ox,oy,r);
    }
    return 0;
}

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

int main()
{
  int setcount;
  float x1, y1, x2, y2, x3, y3;
  float nx1, ny1, nx2, ny2;
  float nr1, nr2;
  float xp, yp, r;
  int tx, ty, tr, rem;
  int i;

  scanf("%d", &setcount);
  for(i=0; i<setcount; i++){

    xp=nr1+x1; yp=nr2+y1;
    r=(float)sqrt((double)(nr1^2+nr2^2));
    tx=xp*10000; ty=yp*10000; tr=r*10000;
    if((rem=tx%10)<5) tx-=rem;
    else tx+=10-rem;
    if((rem=ty%10)<5) ty-=rem;
    else ty+=10-rem;
    if((rem=tr%10)<5) tr-=rem;
    else tr+=10-rem;
    xp=(float)tx*0.0001f; yp=(float)ty*0.0001f; r=(float)tr*0.0001f;

    printf("%.3f %.3f %.3f\n", xp, yp, r);
  }

  return 0;
}