// file: PairWithGcdI.cpp
// object-oriented, iterative

#include "PairWithGcdI.hpp"

#include <cstdlib>

	int PairWithGcdI::gcd () const
	{
		int r = abs(p), 
			s = abs(q), 
			t;
		while (s > 0)
		{
			t = r % s;
			r = s;
			s = t;
		}
		return r;
	}

/*	No constructor needed.
	PairWithGcdI::PairWithGcdI (int new_p, int new_q) 
	{
		set(new_p, new_q);
	}
*/
