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;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;
pair<double,double> A,B,C;
const double EPS = 1e-6,INF = 1e9;

double dist(pair<double,double> a,pair<double,double> b)
{
	double x = a.first - b.first,y = a.second - b.second;
	return sqrt(x * x + y * y);
}

int main()
{
	scanf("%d",&N);
	FOR(i,0,N){
		scanf("%lf%lf%lf%lf%lf%lf",&A.first,&A.second,&B.first,&B.second,&C.first,&C.second);
		pair<double,double> x((A.first + B.first) / 2.0,(A.second + B.second) / 2.0);
		pair<double,double> y((A.first + C.first) / 2.0,(A.second + C.second) / 2.0);
		pair<double,double> ans(INF,INF);
		double p = INF,q = INF,r = INF,s = INF;
		if(abs(A.second - B.second) < EPS){
			ans.first = x.first;
		}
		else{
			p = - (A.first - B.first) / (A.second - B.second);
			q = x.second - x.first * p;
		}
		if(abs(A.second - C.second) < EPS){
			ans.first = y.first;
		}
		else{
			r = - (A.first - C.first) / (A.second - C.second);
			s = y.second - y.first * r;
		}
		assert(p != r);
		if(ans.first == INF){
			ans.first = (s - q) / (p - r);
		}
		if(p != INF){
			ans.second = p * ans.first + q;
		}
		else{
			ans.second = r * ans.first + s;
		}
		printf("%.3f %.3f %.3f\n",ans.first,ans.second,dist(A,ans));
	}

	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int t;
double x1,y_1,x2,y2,x3,y3,x,y,r;
int main(){
    cin>>t;
    for(int i=1;i<=t;i++){
        cin>>x1>>y_1>>x2>>y2>>x3>>y3;
        x=((x1*x1+y_1*y_1-x2*x2-y2*y2)/2*(y_1-y3)-(x1*x1+y_1*y_1-x3*x3-y3*y3)/2*(y_1-y2))/(x1*(y2-y3)+x2*(y3-y_1)+x3*(y_1-y2));
        y=((x1*x1+y_1*y_1-x3*x3-y3*y3)/2*(x1-x2)-(x1*x1+y_1*y_1-x2*x2-y2*y2)/2*(x1-x3))/(x1*(y2-y3)+x2*(y3-y_1)+x3*(y_1-y2));
        r=sqrt((x-x1)*(x-x1)+(y-y_1)*(y-y_1));
        cout<<fixed<<setprecision(3)<<x<<" "<<y<<" "<<r<<endl;
    }
    return 0;
}

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

#define SQ(x) ((x) * (x))

int main(void)
{
    int s;
    int i;
    double x1, x2, x3;
    double y1, y2, y3;
    double a, b, c, d, e, f;
    double l, m, n;
    
    scanf("%d", &s);
    for (i = 0; i < s; i++){
        scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
        
        a = (x1 - x2);
        b = (y1 - y2);
        c = -1 * (SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2));
        d = (x1 - x3);
        e = (y1 - y3);
        f = -1 * (SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3));
        
        l = (c * e - b * f) / (e * a - b * d);
        m = (d * c - a * f) / (d * b - e * a);
        
        n = -1 * (SQ(x1) + SQ(y1) + l * x1 + m * y1);
        
        printf("%.3f %.3f %.3f\n", l / -2.0, m / -2.0, sqrt(SQ(l) + SQ(m) - 4 * n) / 2.0);
    }
    
    return (0);
}

C++: #include <cstdio>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-5;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac & bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(a.Y, a.X);
  return b;
}

int main() {
  int n;
  scanf("%d", &n);
  VP a;
  REP(j, n) {
    REP(i, 3) {
      double x,y;
      scanf("%lf %lf", &x, &y);
      a.push_back(P(x,y));
    }
    P M = (a[0]+a[1])/(P)2;
    P N = (a[1]+a[2])/(P)2;
    P M_v = normal_vector(a[0]-a[1]);
    P N_v = normal_vector(a[1]-a[2]);  
    P o = crosspoint(M, N, M+M_v, N+N_v);
    printf("%.3lf %.3lf %.3lf\n", o.X, o.Y, distPP(o,a[0]));
    a.clear();
  }
  return 0;
}

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

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3;
  cin>>n;
  for(int i=0;cin>>x1>>y1>>x2>>y2>>x3>>y3||i<n;i++){
    double X,Y,L;
    X= ((y2-y1)*(x1*x1-x3*x3+y1*y1-y3*y3)-(y3-y1)*(x1*x1-x2*x2+y1*y1-y2*y2))/
      (2*(x2-x1)*(y3-y1)-2*(y2-y1)*(x3-x1));
    Y= ((x3-x1)*(x1*x1-x2*x2+y1*y1-y2*y2)-(x2-x1)*(x1*x1-x3*x3+y1*y1-y3*y3))/
      (2*(x2-x1)*(y3-y1)-2*(y2-y1)*(x3-x1));
    L= sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1));
    cout<<fixed<<setprecision(3)<<X<<" "<<Y<<" "<<L<<endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    int n;
    double x_1,y_1,x_2,y_2,x_3,y_3,x_4,y_4,x_5,y_5,slope_1,slope_2,x,y,r;
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        scanf("%lf%lf%lf%lf%lf%lf",&x_1,&y_1,&x_2,&y_2,&x_3,&y_3);
        
        if(y_1 - y_2 == 0){
            swap(x_2,x_3);
            swap(y_2,y_3);
        }
        if(y_2 - y_3 == 0){
            swap(x_1,x_2);
            swap(y_1,y_2);
        }
        
        slope_1=-(x_1-x_2)/(y_1-y_2);
        slope_2=-(x_3-x_2)/(y_3-y_2);
        
        x_4 = (x_1+x_2)/2;
        y_4 = (y_1+y_2)/2;
        
        x_5 = (x_3+x_2)/2;
        y_5 = (y_3+y_2)/2;

        x = ((slope_1*x_4-slope_2*x_5)-y_4+y_5)/(slope_1-slope_2);
        
        y = slope_1*x-slope_1*x_4+y_4;
        
        r = (x_1-x)*(x_1-x)+(y_1-y)*(y_1-y);
        
        printf("%.3lf %.3lf %.3lf\n",x,y,sqrt(r));
    }
    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#define INF 100000000
using namespace std;
#define pw(a) (a)*(a)

int main(){
  double x1,x2,x3,y1,y2,y3;
  int n;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double a,b,c,d,e,f,g,l,m,n;
    a = -1*(pw(x1) - pw(x2) + pw(y1) - pw(y2));
    b = -1*(pw(x1) - pw(x3) + pw(y1) - pw(y3));
    l = (a*(y1-y3)+b*(y1-y2))/((y1-y3)*(x1-x2)-(x1-x3)*(y1-y2));
    m = (b-(x1-x3)*l)/(y1-y3);
    n = (x1*l + y1*m) - (pw(x1) + pw(y1));
    printf("%f %f %f\n",-l/2,-m/2,sqrt((pw(l) + pw(m) - 4*n))/2);
  }
  return 0;
}