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 <stdio.h>
#include <string>
#include <iostream>
#include <math.h>

using namespace std;

int sosuu(int n);

int main(){
    double x[3]={0};
    double y[3]={0};
    int i=0;
    scanf("%d",&i);
    while(scanf("%lf",&x[0])!=EOF){
        scanf("%lf",&y[0]);
        scanf("%lf",&x[1]);
        scanf("%lf",&y[1]);
        scanf("%lf",&x[2]);
        scanf("%lf",&y[2]);
        
        double a1= 2*(x[1]-x[0]);
        double b1= 2*(y[1]-y[0]);
        double c1= x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
        
        double a2= 2*(x[2]-x[0]);
        double b2= 2*(y[2]-y[0]);
        double c2= x[0]*x[0]-x[2]*x[2]+y[0]*y[0]-y[2]*y[2];
        
        double xa = (b1*c2-b2*c1)/(a1*b2-a2*b1);
        double ya = (c1*a2-c2*a1)/(a1*b2-a2*b1);
        
        printf("%.3lf %.3lf",xa,ya);
        
    }
    
}

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

class Point {
public:
  double x, y;
  Point(double x=0, double y=0) : x(x), y(y) {}
};

double dist(Point p1, Point p2) {
  return sqrt(pow(p1.x-p2.x, 2.0)+pow(p1.y-p2.y, 2.0));
}

Point circumcenter(Point pa, Point pb, Point pc) {
  double A = abs(atan2(pb.y-pa.y, pb.x-pa.x) - atan2(pc.y-pa.y, pc.x-pa.x));
  double B = abs(atan2(pa.y-pb.y, pa.x-pb.x) - atan2(pc.y-pb.y, pc.x-pb.x));
  double C = abs(atan2(pa.y-pc.y, pa.x-pc.x) - atan2(pb.y-pc.y, pb.x-pc.x));
  double a = dist(pb, pc);
  double b = dist(pa, pc);
  double c = dist(pa, pb);
  return Point((pa.x*sin(A*2)+pb.x*sin(B*2)+pc.x*sin(C*2))
	       /(sin(A*2)+sin(B*2)+sin(C*2)),
	       (pa.y*sin(A*2)+pb.y*sin(B*2)+pc.y*sin(C*2))
	       /(sin(A*2)+sin(B*2)+sin(C*2))
	       );
}

main() {
  Point p[3];
  Point op;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < 3; j++) cin >> p[j].x >> p[j].y;
    op = circumcenter(p[0], p[1], p[2]);
    double A = abs(atan2(p[1].y-p[0].y, p[1].x-p[0].x)
		   - atan2(p[2].y-p[0].y, p[2].x-p[0].x));
    printf("%.3f %.3f %.3f\n", op.x, op.y, dist(p[1],p[2])/(2*sin(A)));
  }
}

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

using namespace std;

double dist(double x1, double y1, double x2, double y2){
	return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}

int main(){

	double x[3], y[3];
	int n;

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

		double a = x[1] - x[0];
		double b = y[1] - y[0];
		double c = x[2] - x[1];
		double d = y[2] - y[1];
		double e = a*a + b*b;
		double f = c*c + d*d;

		double p = (e*c - f*a) / (2 * (b*c - a*d));
		double q = (e*d - f*b) / (2 * (a*d - b*c));

		double r = dist(x[0], y[0], p, q);

		cout.setf(ios::fixed);
		cout.precision(4);
		cout << p << ' ' << q << ' ' << r << endl;
	}

	return 0;
}

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

typedef complex<double> P;
#define X real()
#define Y imag()

#define PI 3.14159265358979


class Triangle{
    P a, b, c;
    double edgeA, edgeB, edgeC;
    double angleA, angleB, angleC;
    double LawOfCosines(double a, double b, double c){
        return acos((b*b+c*c-a*a) / (2.0*b*c));
    }

public:
    Triangle(P p1, P p2, P p3){
        a = p1;
        b = p2;
        c = p3;

        edgeB = abs(c-a);
        edgeA = abs(b-c);
        edgeC = abs(a-b);
        angleA = LawOfCosines(edgeA, edgeB, edgeC);
        angleB = LawOfCosines(edgeB, edgeC, edgeA);
        angleC = LawOfCosines(edgeC, edgeA, edgeB);
    }

    double circumscribedCircleRadius(){
        return (edgeA / sin(angleA) / 2.0);
    }

    double circumscribedCircleX(){
        double A = sin(2.0*angleA);
        double B = sin(2.0*angleB);
        double C = sin(2.0*angleC);

        return ((a.X*A + b.X*B + c.X*C) / (A+B+C));
    }
    double circumscribedCircleY(){
        double A = sin(2.0*angleA);
        double B = sin(2.0*angleB);
        double C = sin(2.0*angleC);

        return ((a.Y*A + b.Y*B + c.Y*C) / (A+B+C));
    }
};

int main(){
    int n;
    double x1, x2, x3;
    double y1, y2, y3;

    cin >> n;

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

        P a(x1, y1);
        P b(x2, y2);
        P c(x3, y3);

        Triangle hoge(a, b, c);
        double r = hoge. circumscribedCircleRadius();

        printf("%.3f %.3f %.3f\n", hoge.circumscribedCircleX(), hoge.circumscribedCircleY(),hoge.circumscribedCircleRadius());
    }

    return 0;
}

C++:  /*
Write a program which prints the central coordinate (px, py) and the radius r of a circumscribed circle of a triangle which is constructed by three points (x1, y1)(x2, y2)(x3, y3) on the plane surface.
 */

#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>

using namespace std;

 /*
http://zo3kirin3.net/?p=297
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q104383420
http://www.nn.iij4u.or.jp/~hsat/misc/math/centre/circumcentre.html
 */

int main() {
	int n; cin >> n;
	vector<double> x(3), y(3), x2(3), y2(3);		// x,yªÀWÌXgAx2,y2ªÀWÌñæÌXg
	
	for (int p=0; p<n; p++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
		for (int i=0; i<3; i++) {
			x2[i] = pow(x[i], 2);
			y2[i] = pow(y[i], 2);
		}
		
		// eÓÌ·³ðßéBO½ûÌèðp
		double a, b, c, a2, b2, c2;
		a2 = abs(pow(x[2]-x[1], 2)+pow(y[2]-y[1], 2));
		b2 = abs(pow(x[0]-x[2], 2)+pow(y[0]-y[2], 2));
		c2 = abs(pow(x[1]-x[0], 2)+pow(y[1]-y[0], 2));
		a = sqrt(a2); b = sqrt(b2); c = sqrt(c2);
		
		// ÊÏBwÌö®ðpB
		double s, S2;
		s = (a+b+c) / 2;
		S2 = s+(s-a)+(s-b)+(s-c);
		
		// OSðßéBö®ÍWeby[WðQÆ©xNgâÁÄÈ¢©çà¾Å«È¢c
		double px, py;
		px = (a2*(b2+c2-a2)*x[0] + b2*(c2+a2-b2)*x[1] + c2*(a2+b2-c2)*x[2]) / (16 * S2);
        py = (a2*(b2+c2-a2)*y[0] + b2*(c2+a2-b2)*y[1] + c2*(a2+b2-c2)*y[2]) / (16 * S2);
        
        // oÍB®`µÄoÍ·éB¼aÍ¼üÌûö®ÅB
        cout << setprecision(3) << fixed << px << " " << py << " " << sqrt(abs(pow(px-x[0], 2)+pow(py-y[0], 2))) << endl;
	}
	
	return 0;
}

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

int main(){
  int n;
  double a,b,c,d,e,f,x,y,r;
  double x1,y1,x2,y2,x3,y3;

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> x1>>y1>>x2>>y2>>x3>>y3;
    a = 2*(x1-x2);
    b = 2*(y1-y2);
    c = +(x1*x1-x2*x2)+(y1*y1-y2*y2);
    d = 2*(x2-x3);
    e = 2*(y2-y3);
    f = +(x2*x2-x3*x3)+(y2*y2-y3*y3);

    x = (double)(c*e-b*f)/(a*e-b*d);
    y = (double)(a*f-c*d)/(a*e-b*d);

    if(x == 0){x = 0;}
    if(y == 0){y = 0;}

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

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