Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var xa, ya, ra, xb, yb, rb float64
		fmt.Scan(&xa, &ya, &ra, &xb, &yb, &rb)
		// println(xa, ya, ra, xb, yb, rb)
		dis := math.Sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb))
		if dis + ra < rb {
			fmt.Println(-2)
		} else if dis + rb < ra {
			fmt.Println(2)
		} else if dis > rb + ra {
			fmt.Println(0)
		} else {
			fmt.Println(1)
		}
	}
}

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

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 dis = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
    if(fabs(ra - rb) > dis)
      if(ra > rb)
	cout << "2" << endl;
      else
	cout << "-2" << endl;
    else if(fabs(ra - rb) <= dis && ra + rb >= dis)
      cout << "1" << endl;
    else
      cout << "0" << endl;
  }
}

C++: // AOJ 0023
#include<iostream>
#include<cmath>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const long double EPS = 1e-16;

long double sq(long double x) {
  return x * x;
}

long double abs(long double x) {
  return (x > 0 ? x : -x);
}
/*
bool eq(long double x, long double y) {
  return abs(x - y) < EPS;
}*/

long double dist(long double xa, long double ya, long double xb, long double yb) {
  return sq(xa - xb) + sq(ya - yb);
}

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    long double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;

    long double d = sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
    
    if (ra - rb > d + EPS) {
      cout << 2 << endl;
    } else if (rb - ra > d + EPS) {
      cout << -2 << endl;
    } else if (d > ra + rb + EPS) {
      cout << 0 << endl;
    } else {
      cout << 1 << endl;
    }
  }
}

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

int main(){
	int n,i;
	double xa,ya,ra,xb,yb,rb;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf",&xa,&ya,&ra,&xb,&yb,&rb);
		double d=sqrt((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya));
		if(d>ra+rb)printf("0\n");
		else if(d>ra-rb&&d>rb-ra)printf("1\n");
		else{
			if(ra>rb)printf("2\n");
			if(ra<rb)printf("-2\n");
		}
	}
	return 0;
}

C++: // AOJ 0023
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

const double EPS = 1e-8;

double sq(double x) {
  return x * x;
}

double abs(double x) {
  return (x > 0 ? x : -x);
}

bool eq(double x, double y) {
  return abs(x - y) < EPS;
}

double dist(int xa, int ya, int xb, int yb) {
  return sq(xa - xb) + sq(ya - yb);
}

int main() {
  int n;
  cin >> n;
  REP(i, n) {
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;

    double d = dist(xa, ya, xb, yb);
    
    if (d < sq(ra)) {
      cout << 2 << endl;
    } else if (d < sq(rb)) {
      cout << -2 << endl;
    } else if (eq(d, ra) or eq(d, rb)) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
class point{ // as necessary
	public:
		static const int COUNTER_CLOCKWISE=1;
		static const int CLOCKWISE=-1;
		static const int ONLINE_BACK=2;
		static const int ONLINE_FRONT=-2;
		static const int ON_SEGMENT=0;
		static const double EPS=1e-10;
		double x;
		double y;
		point(double x=0,double y=0):x(x),y(y){}

		point operator+(point p){return point(x+p.x,y+p.y);}
		point operator-(point p){return point(x-p.x,y-p.y);}
		point operator*(double a){return point(x*a,y*a);}
		point operator/(double a){return point(x/a,y/a);}

		static double dot(const point &p1,const point &p2){
			return p1.x*p2.x+p1.y*p2.y;
		}

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

		static double nrm(point p0){
			return (p0.x)*(p0.x)+(p0.y)*(p0.y);
		}

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

		static double cross(point p1,point p2){
			return p1.x*p2.y-p1.y*p2.x;
		}

		static int ccw(point p0,point p1,point p2){
			point a=p1-p0; // ??????p0p1
			point b=p2-p0; // ??????p0p2
			if(cross(a,b)>EPS) return COUNTER_CLOCKWISE; // a????????????b??????????¨?
			if(cross(a,b)<-EPS) return CLOCKWISE; // a????????????b???????¨?
			if(dot(a,b)<-EPS) return ONLINE_BACK; // p2-p0-p1???????????¢???
			if(a.norm(),b.norm()) return ONLINE_FRONT; // p0-p1-p2???????????¢???
			return ON_SEGMENT; // p0-p2-p1???????????¢???
		}
};

int main(void){
	int n;
	double x,y;
	double r1,r2;
	cin>>n;
	while(n--){
		cin>>x>>y>>r1;
		point a(x,y);
		cin>>x>>y>>r2;
		point b(x,y);
		if(point::nrm(a-b)>(r1+r2)*(r1+r2))cout<<"0"<<endl;
		else if(point::nrm(a-b)<r1*r1)cout<<"2"<<endl;
		else if(point::nrm(a-b)<r2*r2)cout<<"-2"<<endl;
		else if(point::nrm(a-b)<(r1+r2)*(r1+r2))cout<<"1"<<endl;
	}
	return 0;
}

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

double eps = 1e-10;

class Point {
public:
	double x, y;
	
	Point(double x = 0, double y = 0) : x(x), y(y) {}
	
	Point operator + (const Point& p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator - (const Point& p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator * (const double& a) {
		return Point(x * a, y * a);
	}
	Point operator / (const double& a) {
		return Point(x / a, y / a);
	}
	
	bool operator < (const Point& p) const {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator == (const Point& p) const {
		return fabs(x - p.x) < eps && fabs(y - p.y) < eps;
	}
	
	double abs() {
		return sqrt(norm());
	}
	double norm() {
		return x * x + y * y;
	}
	
};

class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};

int main() {
	int n;
	cin >> n;
	double x1, y1, r1, x2, y2, r2;
	for(int i = 0; i < n; ++i){
		cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
		Circle c1 = Circle(Point(x1, y1), r1);
		Circle c2 = Circle(Point(x2, y2), r2);
		double minr = min(c1.r, c2.r);
		double maxr = max(c1.r, c2.r);
		
		if(pow(c2.c.x - c1.c.x, 2.0) + pow(c2.c.y - c1.c.y, 2.0) + pow(minr, 2.0) < pow(maxr, 2.0) / 2.0){
			if(c1.r > c2.r)
				cout << "2" << endl;
			else
				cout << "-2" << endl;
		}
		else if(pow(c2.c.x - c1.c.x, 2.0) + pow(c2.c.y - c1.c.y, 2.0) <= pow(c1.r + c2.r, 2.0)){
			cout << "1" << endl;
		}
		else{
			cout << "0" << endl;
		}
	}
	return 0;
}

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

inline double distance(std::array<double, 2> pa,std::array<double, 2> pb){
	return sqrt( (pa[0] - pb[0])*(pa[0] - pb[0]) + (pa[1] - pb[1])*(pa[1] - pb[1]) );
}

int main(){
	int dataSetNum;
	std::cin >> dataSetNum;
	std::vector<int> number;
	for(int i = 0; i < dataSetNum; ++i){
		std::array<double, 2> pa[i];
		std::array<double, 2> pb[i];
		double ra[i],rb[i];

		std::cin >> pa[i][0] >> pa[i][1] >> ra[i] >> pb[i][0] >> pb[i][1] >> rb[i];
		//if A and B do not overlap
		if(distance(pa[i],pb[i]) > ra[i] + rb[i]) number[i] = 0;
		//if B is in A
		else if(ra[i] > rb[i] && distance(pa[i],pb[i]) + rb[i] <= ra[i]) number[i] = 2;
		//if A is in B,
		else if(rb[i] > ra[i] && distance(pa[i],pb[i]) + ra[i] <= rb[i]) number[i] = -2;
		//if circumference of A and B intersect
		else number[i] = 1;
	}
	for(int i = 0; i < dataSetNum; ++i) std::cout << number[i] << std::endl;
	return 0;
	}

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

using namespace std;

int main()
{
	int n;
	double x1, x2, y1, y2, r1, r2, u;
	while(cin>>n && n){
		while(n--){
			cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
			u = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
			
			if(r1+r2 > u){
				if(r1 > u && r2 > u){
					if(r1 == r2){
						cout << 1 << endl;
					} else if(r1 > r2){
						cout << 2 << endl;
					} else {
						cout << -2 << endl;
					}
				} else if(r1 > u && r2 <= u){
					cout << 2 << endl;
				} else {
					cout << -2 << endl;
				}
			} else if(r1+r2 == u){
				cout << 1 << endl;
			} else {
				cout << 0 << endl;
			}
		}
	}
	
	return 0;
}