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 <iomanip>
#include <cmath>

void solve(double a, double b, double c, double d, double p, double q, double *x, double *y){
    *x = (p * d - b * q) / (a * d - b * c);
    *y = (a * q - p * c) / (a * d - b * c);
}

int main(){
    int n;
    double x1, y1, x2, y2, x3, y3, xp, yp, r, d12, d23, d31;
    
    std::cin >> n;
    for(int i=0; i<n; i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        solve(2 * (x1 - x2), 2 * (y1 - y2), 2 * (x1 - x3), 2 * (y1 - y3),
            pow(x1, 2) + pow(y1, 2) - pow(x2, 2) - pow(y2, 2),
            pow(x1, 2) + pow(y1, 2) - pow(x3, 2) - pow(y3, 2), &xp, &yp);
        d12 = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
        d23 = sqrt(pow(x2 - x3, 2) + pow(y2 - y3, 2));
        d31 = sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2));
        r = d12 * d23 * d31 / sqrt((d12 + d23 + d31)*(-d12 + d23 + d31)*(d12 - d23 + d31)*(d12 + d23 - d31));
        std::cout << std::fixed << std::setprecision(3)
            << xp << ' ' << yp << ' ' << r << std::endl;
    }
}

C++: /* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
// include {{{
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <vector>
#include <complex>
#include <iostream>
#include <algorithm>

using namespace std;

// }}}
/* cpp template {{{*/


#define endl '\n'
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;      // ??§?¨?????????????double???long double?????????
typedef long long ll;
typedef long double lb;
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W){return (y >= 0 && x >= 0 && y < H && x < W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}

/* ?????° */
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


/* }}} */

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // ???????????????
  return a1 + d1/d2 * (a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int x = in();
  
  for (int i = 0; i < x; i++){
    D a1, a2, b1, b2, c1, c2;
    cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2;
    P p = circumcenter( P(a1, a2), P(b1, b2), P(c1, c2));
    D r = sqrt(pow(a1 - p.X, 2) + pow(a2 - p.Y, 2));
    printf("%.4f %.4f %.4f", p.X, p.Y, r);
    cout << endl;
  }
  return (0);
}

C++: /*
 * Problem     : AOJ0010
 * Title       : A New Plan of Aizu Ski Resort (会津山スキー場の新企画)
 * Author      : mizo0203
 * Copyright   : Your copyright free
 * Description : 外接円の中心座標を計算する
 */

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

int n;
double x[3], y[3], xp, yp, r;

void init() {
  scanf("%d", &n);
}

bool input() {
  int i;

  if (!n)
    return false;
  n--;

  for (i = 0; i < 3; i++) {
    scanf("%lf %lf", &x[i], &y[i]);
  }

  return true;
}

int main() {
  double A1, B1, C1, A2, B2, C2;
  init();
  while (input()) {
    A1 = 2 * (x[1] - x[0]);
    B1 = 2 * (y[1] - y[0]);
    C1 = x[0] * x[0] - x[1] * x[1] + y[0] * y[0] - y[1] * y[1];
    A2 = 2 * (x[2] - x[0]);
    B2 = 2 * (y[2] - y[0]);
    C2 = x[0] * x[0] - x[2] * x[2] + y[0] * y[0] - y[2] * y[2];
    xp = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1);
    yp = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1);
    r = sqrt((x[0] - xp) * (x[0] - xp) + (y[0] - yp) * (y[0] - yp));
    printf("%.3f %.3f %.3f\n", xp, yp, r);
  }

  return 0;
}

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 = x[1]*x[1] - x[0]*x[0] + y[1]*y[1] - y[0]*y[0];
		double f = x[2]*x[2] - x[1]*x[1] + y[2]*y[2] - y[1]*y[1];

		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(3);
		cout << p << ' ' << q << ' ' << r << endl;
	}

	return 0;
}

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

using namespace std;

struct Line{
    bool isRightX, isRightY;
    double x, y, a, b;
};

Line getBisector(double x1, double y1, double x2, double y2){
    Line bisector;
    bisector.isRightX = bisector.isRightY = false;
    if ( y1 == y2 ){   
	bisector.isRightY = true;
	bisector.x = ( x1 + x2 ) / 2;
    } else if ( x1 == x2 ){    
	bisector.isRightX = true;
	bisector.y = ( y1 + y2 ) / 2;
    } else {
	bisector.a = ( x2 - x1 ) / ( y1 - y2 );
	bisector.b = ( y1 + y2 ) / 2 - bisector.a * (( x1 + x2 ) / 2);
    }

    return bisector;
}

void compute(){
    double x1, y1, x2, y2, x3, y3, x, y, r;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    Line AB = getBisector(x1, y1, x2, y2);
    Line AC = getBisector(x1, y1, x3, y3);
    if ( AB.isRightX ){
	if ( AC.isRightY ){
	    x = AC.x; y = AB.y;
	} else {
	    y = AB.y; x = (y - AC.b) / AC.a;
	}
    } else if ( AB.isRightY ){ //y ツ篠イツづ可閉スツ行
	if ( AC.isRightX ){
	    x = AB.x; y = AC.y;
	} else {
	    x = AB.x; y = AC.a * x + AC.b;
	}
    } else {
	if ( AC.isRightX ) {
	    y = AC.y; x = (y - AB.b) / AB.a;
	} else if ( AC.isRightY ) {
	    x = AC.x; y = AB.a * x + AB.b;			
	} else {
	    x = (AC.b - AB.b) / (AB.a - AC.a); 
	    y = AB.a * x + AB.b;
	}	
    }
    r = sqrt( (x - x1)*(x - x1) + (y - y1)*(y - y1) );

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

int main(){
    int tcase; cin >> tcase;
    for ( int i = 0; i < tcase; i++ ){
	compute();
    }
    return 0;
}