//Rationals.h #include //we could instead say //using namespace std; using std::cout; using std::cin; using std::ostream; using std::istream; #include using std::ofstream; using std::ifstream; #include using std::abs; //for abs() #ifndef RATIONAL_H #define RATIONAL_H class Rational { public: Rational(); //a default constructor that sets a rational to 1/1. Rational(int n, int d); //a constructor that takes values for the numerator and denominator. //It stores values in reduced form. bool set(int n, int d); //Allows you to set the value of a rational. It stores values in reduced form. //Returns false if you try to set denominator to 0 int getNumerator(); //I've added these accessors int getDenominator(); Rational operator+(Rational right); Rational operator-(Rational right); Rational operator*(Rational right); Rational operator/(Rational right); bool operator>(Rational right); bool operator==(Rational right); bool operator==(int right); ostream& printquotient(ostream & outfile); //I've added a parameter and a return ostream& printdecimal(ostream & outfile); //I've added a parameter and a return istream& read(istream & infile); //I've added a parameter and a return private: int numerator; int denominator; //always positive int gcd(int& a, int& b); }; //global functions bool operator==(int left, Rational right); #endif