#ifndef DANS_RAT_DOT_H #define DANS_RAT_DOT_H class rational { public: rational(); // initialize the fraction to 0/0 rational (int num, int den); // initialize the numerator to num, the denominator to den void print() const; // print the value as num/den int numerator() const; // return the value of the numerator int denominator() const; // return the value of the denominator float value() const; // return float(num)/float(denom( int compare( rational b) const; // return -1 if this one is smaller // return 0 if they are the same // return 1 if this one is bigger rational add(rational b) const; // add b to this value and return the reslult rational subtract(rational b) const; // subtract b from this value and return the reslult rational mpy(rational b) const; // multiply b and this value and return the reslult rational divide(rational b) const; // divide this value by b and return the reslult void read() ; // read in a rational number // in the form a/b void reduce() ; // remove common factors from numerator and denominator bool operator ==( rational b); rational operator +( rational b); rational operator +( int b); friend ostream& operator <<(ostream & s , rational a); private: int numer; int denom; }; #endif //DANS_RAT_DOT_H