Go: package main

import (
        "fmt"
        "math"
)

func main() {
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                var ax, ay, ar, bx, by, br float64
                fmt.Scanf("%f %f %f %f %f %f", &ax, &ay, &ar, &bx, &by, &br)

                d := math.Sqrt((bx-ax)*(bx-ax) + (by-ay)*(by-ay))
                if d <= ar + br {
                        if ar > br {
                                if ar > br + d {
                                        fmt.Println("2")
                                } else {
                                        fmt.Println("1")
                                }
                        } else {
                                if br > ar + d {
                                        fmt.Println("-2")
                                } else {
                                        fmt.Println("1")
                                }
                        }
                } else {
                        fmt.Println(0)
                }
        }
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const double eps = 1e-9;
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

#define equals(a, b) (fabs(a - b) < EPS)

struct Point {
  double x, y;

  Point() {}
  Point(double x, double y) :x(x), y(y){}

  Point operator+(Point p) { return Point(this->x + p.x, this->y + p.y); }
  Point operator-(Point p) { return Point(this->x - p.x, this->y - p.y); }
  Point operator*(double k){ return Point(this->x * k, this->y * k); }
  Point operator/(double k){ return Point(this->x / k, this->y / k); }

  double norm() { return x * x + y * y; }
  double abs()  { return sqrt(norm()); }
};

struct Circle {
  double r;
  Point c;
  Circle() {}
  Circle(Point c, double r) :c(c), r(r){}
  Circle(double x, double y, double r) :c(Point(x, y)), r(r){}
};

double norm(Point a) {
  return a.x * a.x + a.y * a.y;
}

double abs(Point a) {
  return sqrt(norm(a));
}

static const int ICC_SEPARATE = 0;
static const int ICC_CIRCUMSCRIBE = 1;
static const int ICC_INTERSECT = 1;
static const int ICC_INSCRIBE = 2;
static const int ICC_CONTAIN = 2;

int intersectCC(Circle c1, Circle c2){
  int f = 1;
  if(c1.r < c2.r) { f *= -1; swap(c1, c2); }

  double d = abs(c1.c - c2.c);
  double r = c1.r + c2.r;

  if(equals(d, r)) return ICC_CIRCUMSCRIBE;
  if(d > r) return ICC_SEPARATE;
  if(equals(d + c2.r, c1.r)) return ICC_INSCRIBE * f;
  if(d + c2.r < c1.r) return ICC_CONTAIN * f;
  return ICC_INTERSECT;
}

signed main() {
  int n = in();
  while (n--) {
    Circle c1, c2;
    double x, y, r;
    cin >> x >> y >> r;
    c1 = Circle(x, y, r);

    cin >> x >> y >> r;
    c2 = Circle(x, y, r);

    cout << intersectCC(c1, c2) << endl;
  }
}

C++: // 2014/09/08 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;

	for(int i=0; i<N; i++){
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;

		double d2 = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
		double rp = (ra+rb)*(ra+rb);
		double rm = (ra-rb)*(ra-rb);

		if(d2<rm && ra>rb){
			cout << 2 << endl;
		}
		else if(d2<rm && ra<rb){
			cout << -2 << endl;
		}
		else if(d2<=rp){
			cout << 1 << endl;
		}
		else{
			cout << 0 << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>

using namespace std;

void Solution()
{
    int n;
    
    cin>>n;
    
    while(n--)
    {
        float xa, ya, ra;
        float xb, yb, rb;
        float d;
        
        cin>>xa>>ya>>ra>>xb>>yb>>rb;
        
        d = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya)); // distance of o1 and o2
        
        if (fabs(d < ra - rb) && (ra > rb))
        {
            cout<<2<<endl;
        }
        else if (fabs(d < ra - rb) && (ra < rb))
        {
            cout<<-2<<endl;
        }
//        else if (fabs(d > ra - rb) && (d < ra + rb))
//        {
//            cout<<"1"<<endl;
//        }
        else if (d > ra + rb)
        {
            cout<<0<<endl;
        }
        else
        {
            cout<<1<<endl;
        }
    }
}

int main()
{
    Solution();
    return 0;
}

C++: #include <iostream>

int check_circle(const double xa, const double ya, const double ra,
                 const double xb, const double yb, const double rb){
  double distance;
  distance = (xa - xb)*(xa - xb) + (ya - yb)*(ya - yb);

  if(distance > (ra + rb)*(ra + rb) ){
    return 0;
  }
  else if(distance < (ra - rb)*(ra - rb) ){
    if(ra > rb){
      return 2;
    }
    else{
      return -2;
    }
  }
  else{
    return 1;
  }
}

int main(){
  int data_num;
  std::cin >> data_num;

  for(int i = 0; i < data_num; ++i){
    double xa, ya, ra, xb, yb, rb;
    std::cin >> xa >> ya >> ra
             >> xb >> yb >> rb;
    std::cout << check_circle(xa, ya, ra, xb, yb, rb) << std::endl;
  }

}

C++: #include <iostream>

using namespace std;


int main()
{
  int i;
  cin>>i;
  for(;i--;)
    {

      double xa,ya,ra,xb,yb,rb;     
      int ans;
      cin>>xa>>ya>>ra>>xb>>yb>>rb;
      int d = (xa-xb)*(xa-xb)+(ya-yb)*(ya-yb);
      if(d  <= (ra-rb)*(ra-rb))
	ans = 2;
      else if (d  <= (rb-ra)*(rb-ra))
	ans =-2;
      else if((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)>(ra+rb)*(ra+rb))
	ans = 0;
      else
	    ans =-1;

      cout<<ans<<endl;

    }

}