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 <math.h>

double ceil2(double dIn, int nLen) {
	double dOut;

	dOut = dIn * pow(10.0, nLen);
	dOut = (double)(int)(dOut + 0.9);

	return dOut * pow(10.0, -nLen);
}

int main(void) {

	double x1[20], x2[20], x3[20], y1[20], y2[20], y3[20];
	double distance_12[20],distance_23[20],distance_31[20];
	int n = 0,i=0;
	double cosA,sinA,r,p,q;

	do {
		scanf("%d",&n);
	} while (n > 20);
	

	do {
		scanf("%lf%lf%lf%lf%lf%lf",&x1[i],&y1[i],&x2[i],&y2[i],&x3[i],&y3[i]);
		if((-100 <= (x1[i], x2[i], x3[i], y1[i], y2[i], y3[i])&&(100 >= (x1[i], x2[i], x3[i], y1[i], y2[i], y3[i]))))
		i++;
	} while (i < n);
	
	for (i = 0; i < n; i++) {
		distance_12[i] = sqrt(pow(x1[i] - x2[i], 2) + pow(y1[i] - y2[i], 2));
		distance_23[i] = sqrt(pow(x2[i] - x3[i], 2) + pow(y2[i] - y3[i], 2));
		distance_31[i] = sqrt(pow(x3[i] - x1[i], 2) + pow(y3[i] - y1[i], 2));
		}

	for (i = 0; i < n; i++) {
		p = ((y1[i] - y3[i])*(pow(y1[i],2) - pow(y2[i],2) + pow(x1[i],2) - pow(x2[i],2)) - (y1[i] - y2[i])*(pow(y1[i],2) - pow(y3[i],2) + pow(x1[i],2) - pow(x3[i],2))) / (2*(y1[i] - y3[i])*(x1[i] - x2[i]) - 2*(y1[i] - y2[i])*(x1[i] - x3[i]));
		q = ((x1[i] - x3[i])*(pow(x1[i],2) - pow(x2[i],2) + pow(y1[i],2) - pow(y2[i],2)) - (x1[i] - x2[i])*(pow(x1[i], 2) - pow(x3[i], 2) + pow(y1[i], 2) - pow(y3[i], 2))) / (2 * (x1[i] - x3[i])*(y1[i] - y2[i]) - 2 * (x1[i] - x2[i])*(y1[i] - y3[i]));
		cosA = (pow(distance_23[i], 2) + pow(distance_31[i], 2) - pow(distance_12[i], 2))/(2*distance_23[i]*distance_31[i]);
		sinA = sqrt(1 - pow(cosA, 2));
		r = distance_12[i] / (sinA * 2);
		printf("%.3lf %.3lf %.3lf\n",ceil2(p,4),ceil2(q,4),ceil2(r,4));
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){

  double x1,y1,x2,y2,x3,y3;
  double px,py;
  int n;

  cin >> n;

  for(int i=0; i<n; i++){
    cin >> x1>>y1>>x2>>y2>>x3>>y3;
    px = ( (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 = ( (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));
    cout << px <<" "<< py <<" "<< sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1)) << endl;

  }


  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
class Point{
	public:
	double x,y;
	void input(){
		cin>>x>>y;
	}
};
double dist(Point a,Point b){
	return sqrt(pow(a.x-b.x,2.0)+pow(a.y-b.y,2.0));
}
class Line{
	public:
	double a,b,c;//ax+by=c
	Line(Point s,Point t){
		//x=(x1+x2)/2 , y=(y1+y2)/2を通り、
		//傾きa=-(x1-x2)/(y1-y2)の直線
		//(y1-y2)(y-(y1+y2)/2) = -(x1-x2)(x-(x1+x2)/2)
		//(x1-x2)x + (y1-y2)y = (x1^2-x2^2)/2 + (y1^2-y2^2)/2
		a=s.x-t.x;	b=s.y-t.y;
		c=((s.x+t.x)*(s.x-t.x)+(s.y+t.y)*(s.y-t.y))/2.0;
	}
	void multi(double x){
		a*=x;	b*=x;	c*=x;
	}
};
double searchx(Line s,Line t){
	double tmp=s.b;
	s.multi(t.b);	t.multi(tmp);
	return (s.c-t.c)/(s.a-t.a);
}
double searchy(Line s,Line t){
	double tmp=s.a;
	s.multi(t.a);	t.multi(tmp);
	return (s.c-t.c)/(s.b-t.b);
}
int main(){
	int n;	cin>>n;
	while(n--){
		Point a,b,c;
		a.input();	b.input();	c.input();
		Line l(a,b),m(b,c);
		Point center;
		center.x=searchx(l,m);	center.y=searchy(l,m);
		double dis=dist(center,a);
		printf("%.3lf %.3lf %.3lf\n",center.x,center.y,dis);
	}
	return 0;
}

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

int main(){
    int n;
    double x1, x2, x3, y1, y2, y3, x, y;
    cin >> n;
    for(int i = 0;i < n;i++){
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	if(y1 == y2)swap(x1, x3), swap(y1, y3);
	else if(y1 == y3)swap(x1, x2), swap(y1, y2);
	double x = (x3-x1)/(y1-y3)*(x1+x3)/2-(x2-x1)/(y1-y2)*(x1+x2)/2-(y1+y2)/2+(y1+y3)/2;
	x /= ((x3-x1)/(y1-y3) - (x2-x1)/(y1-y2));
	double y = (x2-x1)/(y1-y2)*(x - x1+x2/2) + (y1+y2)/2;
	cout << x << " " << y << " " << hypot(x1-x,y1-y) << endl;   
    }
    return 0;
}
/*
x1y1 x2y2
y = (x2-x1)/(y1-y2)*(x - x1+x2/2) + y1+y2/2
y = (x3-x1)/(y1-y3)*(x - x1+x3/2) + y1+y3/2


(x3-x1)/(y1-y3)*(x - x1+x3/2) + y1+y3/2
 = (x2-x1)/(y1-y2)*(x - x1+x2/2) + y1+y2/2
((x3-x1)/(y1-y3) - (x2-x1)/(y1-y2))*x
=
(x3-x1)/(y1-y3)*(x1+x3)/2-(x2-x1)/(y1-y2)*(x1+x2)/2+(y1+y2)/2-(y1+y3)/2

*/

C++: #include<stdio.h>
#include<math.h>
double sisyagonyuu3(double moto){
	if(moto>0){
		return (moto+0.0005)/100*100;
	}else if(moto==0){
		return 0;
	}else{
		return (moto-0.0005)/100*100;
	}
}
int main()
{
	int n;
	double x1[32],x2[32],x3[32],y1[32],y2[32],y3[32],p,q,r;
	double ac,ab,bc,a,b,c;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lf%lf%lf%lf%lf%lf",&x1[i],&x2[i],&x3[i],&y1[i],&y2[i],&y3[i]);
		p=sisyagonyuu3(((y1[i]-y3[i])*(y1[i]*y1[i]-y2[i]*y2[i]+x1[i]*x1[i]-x2[i]*x2[i])-(y1[i]-y2[i])*(y1[i]*y1[i]-y3[i]*y3[i]+x1[i]*x1[i]-x3[i]*x3[i]))/(2*(y1[i]-y3[i])*(x1[i]-x2[i])-2*(y1[i]-y2[i])*(x1[i]-x3[i])));
		q=sisyagonyuu3(((x1[i]-x3[i])*(x1[i]*x1[i]-x2[i]*x2[i]+y1[i]*y1[i]-y2[i]*y2[i])-(x1[i]-x2[i])*(x1[i]*x1[i]-x3[i]*x3[i]+y1[i]*y1[i]-y3[i]*y3[i]))/(2*(x1[i]-x3[i])*(y1[i]-y2[i])-2*(x1[i]-x2[i])*(y1[i]-y3[i])));
		ab=sqrt(fabs((x3[i]-x1[i])*(x3[i]-x1[i])+(y3[i]-y1[i])*(y3[i]-y1[i])));
		ac=sqrt(fabs((x3[i]-x2[i])*(x3[i]-x2[i])+(y3[i]-y2[i])*(y3[i]-y2[i])));
		bc=sqrt(fabs((x2[i]-x1[i])*(x2[i]-x1[i])+(y2[i]-y1[i])*(y2[i]-y1[i])));
		a=bc;
		b=ac;
		c=ab;
		r=a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
		printf("%.3lf %.3lf %.3lf\n",p,q,r);
	}
	return 0;
}
/*?????\???*/