#include <string> class fraction { public: //Default constructor, initializes to 0 fraction(); //Constructor which takes a numerator and denominator fraction(int,int); //Constructor which takes an integer fraction(int); //Returns a string to print a human readable version of the fraction std::string toString(); //Arithmetic operators. The inclusion of a constructor that takes //integers means that we can also use these to //add/subtract/multiply/divide fractions and integers as well as //fractions and other fractions. fraction operator+ (fraction); fraction operator- (fraction); fraction operator* (fraction); fraction operator/ (fraction); protected: //Initialization is called by all constructors void initialize(int,int); //Simplify reduces the fraction, when possible. This is called by //initialize. void simplify(); //Recursive method to determine the greatest common divisor. This is //used by simplify(). int gcd(int a, int b); int numerator; int denominator; };