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 <iomanip>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		double x1,x2,x3,y1,y2,y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double c1 = 2.0*(x1-x2);
		double c2 = 2.0*(y1-y2);
		double c3 = 2.0*(x1-x3);
		double c4 = 2.0*(y1-y3);
		double c5 = x1*x1 + y1*y1;
		double c6 = x2*x2 + y2*y2;
		double c7 = x3*x3 + y3*y3;
		double px = (c4*(c5-c6)-c2*(c5-c7))/(c1*c4-c2*c3);
		double py = (c5-c6-c2*py)/c1;
		double r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
		cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
	double n;
	double x1, x2, x3;
	double y1, y2, y3;
	cin >> n;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	double px, py, r;
	double A = (x2 - x1)*(y3 - y2) - (y2 - y1)*(x3 - x2);
	px = 0.5*((y3 - y2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) - (y2 - y1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A;
	py = 0.5*(-(x3 - x2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) + (x2 - x1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A;
	double a = px - x1;
	double b = py - y1;
	double r0 = (a*a + b*b);
	double r1 = sqrt(r0);
	cout << fixed << setprecision(10) << px << ' ' << py << ' ' << r1 <<  endl;
}

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

int main()
{
    double x1,y1,x2,y2,x3,y3,m1,m2,h,k,c,r;
    int i,j,t;
    scanf("%d",&t);
    for(i=1; i<=t; i++)
    {
        scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);

        m1=(y2-y1)/(x2-x1);
        m2=(y3-y1)/(x3-x1);
        if(m2==0)
        {
            k=(x2-x3)/m1/2+(y1+y2)/2;
            h=(x1+x3)/2;
        }
        else if(m1==0)
        {
            k=(x3-x2)/m2/2+(y1+y3)/2;
            h=(x1+x2)/2;
        }
        else if(m1!=0&&m2!=0)
        {
            h=((x1+x2)/m1-(x1+x3)/m2+y2-y3)/2/(1/m1 - 1/m2);
            k=( h-(x1+x2)/2)/(-m1)+(y1+y2)/2;
        }
        r=sqrt((h-x1)*(h-x1)+(k-y1)*(k-y1));
        printf("%.3lf %.3lf %.3lf\n",h,k,r);



    }
    return 0;
}

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))));
	}

	for (int i = 0; i < cnt; i++){
		double result_p;
		double result_q;
		double result_r;

		result_p = round(p[i], 3);
		result_q = round(q[i], 3);
		result_r = round(r[i], 3);

		std::cout << std::fixed << std::setprecision(3) << result_p << " " << result_q << " " << result_r << 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<stdio.h>
#include<math.h>

using namespace std;

#define MAX 256

float LOSER(float x){
	if((int)(x*10000)%10 > 4)return x + 0.001;
	return x;
}

int main(void){
	int n,i = 0;
	float x1,y1,x2,y2,x3,y3;
	float px[MAX],py[MAX],r[MAX];
	
	cin >> n;
	while(i < n){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		px[i] = ((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[i] = ((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));
		r[i] = sqrt((px[i]-x1)*(px[i]-x1)+(py[i]-y1)*(py[i]-y1));
		px[i]=LOSER(px[i]);
		py[i]=LOSER(py[i]);
		r[i]=LOSER(r[i]);
		i++;
	}
	
	for(int i = 0;i < n;i++){
		scanf("%.3f %.3f %.3f",px[i],py[i],r[i]);
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8, pi = acos(-1.0);
bool eq(ld a, ld b){return (abs(b-a)<eps);}
ld dot(Point a, Point b){return real(conj(a)*b);}
ld cross(Point a, Point b){ return imag(conj(a)*b);}
class Line{
public:
  Point a,b;
};
Line Midependicular(const Point& a, const Point& b){
  Point normal = Point(a.imag()-b.imag(),b.real()-a.real());
  Line result;
  result.a = (b + a + normal) * 0.5L;
  result.b = (b + a - normal) * 0.5L;
  return result;
}
Point a,b,c;
void solve(){
  // center point is the cross point of 2 midperpendiculars
  Line s = Midependicular(a,b);
  Line t = Midependicular(a,c);
  Point sv=s.b-s.a,tv=t.b-t.a;
  Point result=s.a+sv*cross(tv,t.a-s.a)/cross(tv,sv);
  printf("%.3Lf %.3Lf %.3Lf\n",result.real(),result.imag(),abs(result-a));
}

int main(){ _;
  int n;cin>>n;
  REP(z,n){
    ld tmpX,tmpY;
    cin>>tmpX>>tmpY; a=Point(tmpX,tmpY);
    cin>>tmpX>>tmpY; b=Point(tmpX,tmpY);
    cin>>tmpX>>tmpY; c=Point(tmpX,tmpY);
    solve();
  }
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


inline double inp(const P &a, const P &b) {
	return (conj(a) * b).real();
}

inline double outp(const P &a, const P &b) {
	return (conj(a) * b).imag();
}

P circumc(const P &a, const P &b, const P &c) {
	return (a + b - (inp(c - b, a - c) / outp(b - a, c - b)) * (b - a) * P(0, 1)) / 2.0;
}

int main(){
	int n; cin >> n;
	while (n--) {
		double x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		P p1(x1, y1), p2(x2, y2), p3(x3, y3);
		P c = circumc(p1, p2, p3);
		double r = abs(p1 - c);
		double x = c.real();
		double y = c.imag();
		if (fabs(x + 0.0005) < 0.001) x = 0;
		if (fabs(y + 0.0005) < 0.001) y = 0;
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}