#include #include using std::cout; // See gcd.rs for explanation. class results { public: int gcd, s, t; }; results gcd(int a, int b) { int quo = a / b, rem = a % b; return (rem) ? gcd(b, rem) : results{b, quo, 0}; // XXX all wrong } int main(int argc, char **argv) { int a = atoi(argv[1]), b = atoi(argv[2]); results r = gcd(a, b); cout << "gcd(" << a << ", " << b << ") = (" << r.gcd << ", " << r.s << ", " << r.t << ")\n"; return 0; }