Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#ifndef RATIONAL_H #define RATIONAL_H // class who represents fraction class Rat

ID: 3652810 • Letter: #

Question

#ifndef RATIONAL_H #define RATIONAL_H

// class who represents fraction class Rational { public: Rational(); // default constructor Rational(int numerator, int denominator); // alternate constructor // for all operators: // r - right term of the operation // return value - result of operation const Rational operator+(const Rational &r); // overloading the addition operator const Rational operator-(const Rational &r); // overloading the subtraction operator const Rational operator*(const Rational &r); // overloading the multiply operator const Rational operator/(const Rational &r); // overloading the division operator void PrintRational(); // print as fraction void PrintFloating(); // print as floating-point void Set(int numerator, int denominator); // changes the fraction private: int n; // numerator int dn; // denoinator void simplify(); // make reduced form };
#endif // RATIONAL_H
#ifndef RATIONAL_H #define RATIONAL_H

// class who represents fraction class Rational { public: Rational(); // default constructor Rational(int numerator, int denominator); // alternate constructor // for all operators: // r - right term of the operation // return value - result of operation const Rational operator+(const Rational &r); // overloading the addition operator const Rational operator-(const Rational &r); // overloading the subtraction operator const Rational operator*(const Rational &r); // overloading the multiply operator const Rational operator/(const Rational &r); // overloading the division operator void PrintRational(); // print as fraction void PrintFloating(); // print as floating-point void Set(int numerator, int denominator); // changes the fraction private: int n; // numerator int dn; // denoinator void simplify(); // make reduced form };
#endif // RATIONAL_H

Explanation / Answer

looks to be in cpp already...have you tried running this with a Cpp compiler?