Hello, im looking for help on adding overload operators to mycode. It needs to consist of
- + (addition) for the Fraction class
- * (multiplication), no need not reduce
- == (equality operator)
- = (assignment operator)
- << and >> so in main you can use << and>> as follows: cin>>frac1; cout<<frac1; where frac1 is a an object of the Fractionclass
the original code is:
#include <iostream>
using namespace std;
class Fractions {
private:
int numerator;
int denominator;
public:
void NumeratorDenominator(int n, int d);
int getNumerator() const{
return numerator;
}
int getDenominator()const {
return denominator;
}
void print()const;
};
int main() {
Fractions f1;
Fractions f2;
cout << ” Testing 9/0″ << endl;
f1.NumeratorDenominator(9,
OR
OR