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++: #include<bits/stdc++.h>
using namespace std;
typedef complex<double> point;
typedef pair<point, point> line;
double cross(point a, point b){
  return imag(conj(a) * b);
}


point cross_point(line a, line b){
  double d1 = cross(b.second - b.first,
                    b.first - a.first);
  double d2 = cross(b.second - b.first,
                    a.second - a.first);
  return a.first + (a.second - a.first) * (d1/d2);
}

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    point x[3];
    for (int j = 0; j < 3; j++) {
      double real, imag;
      cin >> real >> imag;
      x[j] = point(real, imag);
    }
    point m1 = (x[0] - x[1]), m2 = (x[1] - x[2]);
    m1 = point(m1.real()/2, m1.imag()/2);
    m2 = point(m2.real()/2, m2.imag()/2);
    line n1 = line(m1*point(0, 1), m1*point(0, -1)),
      n2 = line(m2*point(0, 1), m2*point(0, -1));
    n1.first += m1 + x[0];
    n1.second += -m1 + x[0];
    n2.first += m2 + x[1];
    n2.second += -m2 + x[1];
      
    point center = cross_point(n1, n2);
    center -= 
      printf("%5lf %5lf %5lf\n", center.real(), center.imag(),
             abs(center - x[0]));
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;

int main()
{
	int i,n;
	double x1,x2,x3,y1,y2,y3;
	double m1,m2,xm1,xm2,ym1,ym2,xo,yo,r;
	//m1,m2…辺の法線 xm1,ym1…辺の中点の座標

	cin>>n;
	for(i=0;i<n;i++){
		flg=0;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;

		xm1=(x1+x2)/2;
		xm2=(x2+x3)/2;
		ym1=(y1+y2)/2;
		ym2=(y2+y3)/2;
		
		if(y1-y2!=0) 		m1=(-1)*(x1-x2)/(y1-y2);
		else if(y1-y2==0)	flg=1;
		
		if(y2-y3!=0)		m2=(-1)*(x2-x3)/(y2-y3);
		else if(y2-y3==0)	flg=2;
		
		if(flg==0) 	xo=(m1*xm1-m2*xm2+ym2-ym1)/(m1-m2);
		else if(flg==1)xo=xm1;
		else if(flg==2)xo=xm2;

		if(flg==1)yo=m2*(xo-xm2)+ym2;
		else		yo=m1*(xo-xm1)+ym1;
		r=sqrt((x1-xo)*(x1-xo)+(y1-yo)*(y1-yo));
		printf("%.3lf %.3lf %.3lf \n",xo,yo,r);
	}
}

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

int main(void) {

  int data;
  double x1,y1,x2,y2,x3,y3;

  double x12,y12,x13,y13;
  double ang12,ang13;
  double xp,yp,r;

  int flag;
  int i;

  scanf("%d",&data);

  for(i=0;i<data;i++) {
    flag=1;
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);

    x12=(x1+x2)/2.0;
    y12=(y1+y2)/2.0;
    x13=(x1+x3)/2.0;
    y13=(y1+y3)/2.0;

    if(y1==y2) {

      xp=x12;

      ang13=-(x3-x1)/(y3-y1);

      yp=ang13*(xp-x13)+y13;

      flag=0;

    }

    if(y1==y3) {

      xp=x13;
      
      ang12=-(x2-x1)/(y2-y1);

      yp=ang12*(xp-x12)+y12;

      flag=0;

    }

    if(flag==1) {

      ang12=-(x2-x1)/(y2-y1);
      ang13=-(x3-x1)/(y3-y1);

      xp=(ang12*x12-ang13*x13-y12+y13)/(ang12-ang13);

      yp=ang12*(xp-x12)+y12;
    
    }

    r=sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));

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

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

		if((y2-y1) == 0){
			a = 2*(x3 - x1);
			b = 2*(y3 - y1);
			c = (x3 - x1)*(x1 + x3) + (y3 - y1)*(y1 + y3);

			d = 2*(x3 - x2);
			e = 2*(y3 - y2);
			f = (x3 - x2)*(x2 + x3) + (y3 - y2)*(y2 + y3);
		}else if((y3-y1) == 0){

			a = 2*(x3 - x2);
			b = 2*(y3 - y2);
			c = (x3 - x2)*(x2 + x3) + (y3 - y2)*(y2 + y3);

			d = 2*(x2 - x1);
			e = 2*(y2 - y1);
			f = (x2 - x1)*(x1 + x2) + (y2 - y1)*(y1 + y2);
		}else{

			a = 2*(x3 - x1);
			b = 2*(y3 - y1);
			c = (x3 - x1)*(x1 + x3) + (y3 - y1)*(y1 + y3);

			d = 2*(x2 - x1);
			e = 2*(y2 - y1);
			f = (x2 - x1)*(x1 + x2) + (y2 - y1)*(y1 + y2);
		}
		function();
		double r;
		r = sqrt((x - x1)*(x - x1) + (y - y1)*(y - y1));

		printf("%.3lf %.3lf %.3lf",x, y, 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))));

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