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 <iomanip>

using namespace std;

    // 半径取得の処理
double getR(double x1, double y1, double x2, double y2, double x3, double y3) {
    
    double marginX1, marginX2, marginX3;
    double marginY1, marginY2, marginY3;
    double a, b, c;
    double r, s;
    
        // それぞれのxとyの長さを求める
    marginX1 = abs(x2 - x1);
    marginY1 = abs(y2 - y1);
    marginX2 = abs(x1 - x3);
    marginY2 = abs(y1 - y3);
    marginX3 = abs(x3 - x2);
    marginY3 = abs(y3 - y2);
    
        // それぞれの辺の長さを求める
    a = sqrt(pow(marginX1,2) + pow(marginY1,2));
    b = sqrt(pow(marginX2,2) + pow(marginY2,2));
    c = sqrt(pow(marginX3,2) + pow(marginY3,2));
    
        // 半径を求める
    s = (a + b + c) / 2;
    r = (a * b * c) / (4 * sqrt(s * (s - a) * (s - b) * (s - c)));
    
    r *= 10000;
    r = (int)r;
    r /= 10;
    r = round(r);
    r /= 1000;
    
    return r;
}

    // 中心座標を求める処理
void getCentralCoodinate(double x1, double y1, double x2, double y2, double x3, double y3, double *xp, double *yp) {
    
    double marginX1, marginX2;
    double marginY1, marginY2;
    double marginXp1, marginXp2;
    double marginYp1, marginYp2;
    double n, m;
    
        // 初期化
    *xp = 0;
    *yp = 0;
    
        // それぞれのxとyの長さを求める
    marginX1 = abs(x2 - x1);
    marginY1 = abs(y2 - y1);
    marginX2 = abs(x1 - x3);
    marginY2 = abs(y1 - y3);
    
        // 中心座標を求めるのに必要な式
    marginXp1 = 2 * marginX1;
    marginYp1 = 2 * marginY1;
    marginXp2 = 2 * marginX2;
    marginYp2 = 2 * marginY2;
    
    n = pow(x1,2) - pow(x2,2) + pow(y1,2) - pow(y2,2);
    m = pow(x1,2) - pow(x3,2) + pow(y1,2) - pow(y3,2);
    
    *xp = (marginYp1 * m - marginYp2 * n) / (marginXp1 * marginYp2 - marginXp2 * marginYp1);
    *yp = (marginXp2 * n - marginXp1 * m) / (marginXp1 * marginYp2 - marginXp2 * marginYp1);
    
    *xp *= 10000;
    *xp = (int)*xp;
    *xp /= 10;
    *xp = round(*xp);
    *xp /= 1000;
    
    *yp *= 10000;
    *yp = (int)*yp;
    *yp /= 10;
    *yp = round(*yp);
    *yp /= 1000;
}

    // main処理
int main(void) {
    double x1, x2, x3;
    double y1, y2, y3;
    double xp, yp;
    double r;
    int n;
    
    cin >> n;
    
    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
        
            // 半径と中心座標を取得する処理
        r = getR(x1, y1, x2, y2, x3, y3);
        getCentralCoodinate(x1, y1, x2, y2, x3, y3, &xp, &yp);
        
            // 出力
        cout << setprecision(3);
        cout << setiosflags(ios::fixed);
        cout << xp << " " << yp << " " << r << endl;
    }
    
    return 0;
}

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

int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x1_2,x1_3,y1_2,y1_3,z1_2,z1_3,a,b,c,r;
	while(cin >> n){
		for(int i = 0;i < n;++i){
			cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
			z1_2 = (((x1 * x1) + (y1 * y1)) * -1) - (((x2 * x2) + (y2 * y2)) * -1);
			z1_3 = (((x1 * x1) + (y1 * y1)) * -1) - (((x3 * x3) + (y3 * y3)) * -1);
			x1_2 = x1 - x2;
			x1_3 = x1 - x3;
			y1_2 = y1 - y2;
			y1_3 = y1 - y3;
			a = ((y1_2 * z1_3) - (y1_3 * z1_2)) / ((y1_2 * x1_3) - (y1_3 * x1_2)) * -1;
			b = ((x1_2 * z1_3) - (x1_3 * z1_2)) / ((x1_2 * y1_3) - (x1_3 * y1_2)) * -1;
			c = ((x1 * x1) + (y1 * y1) + (a * x1) + (b * y1)) * -1;
			r = sqrt(c + (a * a / 4) + (b * b / 4)) + 0.0005;
			a = a / 2 + 0.0005;
			b = b / 2 + 0.0005;
			printf("%.3f %.3f %.3f",a,b,r);
		}
	}
	return 0;
}

C++: 
// Circumscribed Circle of a Triangle


#include<stdio.h>
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main(void)
{
	int n; cin >> n;
	double x[3];
	double y[3];
	double r;

	while(n--){
	 for(int j=0;j<3;j++){
	 	cin >> x[j] >> y[j];
	 }

	 double a = 2*(x[1]-x[0]);
	 double b = 2*(y[1]-y[0]);
	 double c = 2*(x[2]-x[0]);
	 double d = 2*(y[2]-y[0]);

	 double e = pow(x[1],2.0)-pow(x[0],2.0)+pow(y[1],2.0)-pow(y[0],2.0);
	 double f = pow(x[2],2.0)-pow(x[0],2.0)+pow(y[2],2.0)-pow(y[0],2.0);

	 if(a==0){
	 	swap(a,c);
	 	swap(b,d);
	 	swap(e,f);
	 }

	b = b/a;
	e = e/a;
	a = a/a;
	 
	 
	d = d-b*c;
	f = f-e*c;
	c = c-a*c;

	f = f/d;
	d = d/d;

	b = b-d*b;
	e = e-f*b;

	r = sqrt(pow((e-x[0]),2.0)+pow((f-y[0]),2.0));
	
	// cout << fixed;
	// cout << setprecision(3) << e <<" "<< f << " " << r << endl;
	printf("%.3lf %.3lf %.3lf\n", e, f, 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);
}