Euclid's algorithm in C++