class Fraction
{
friend Fraction operator+(const Fraction& f1, const Fraction& f2);
friend Fraction operator-(const Fraction& f1, const Fraction& f2);
friend Fraction operator*(const Fraction& f1, const Fraction& f2);
friend Fraction operator/(const Fraction& f1, const Fraction& f2);
friendbooloperator != (const Fraction& f1, Fraction& f2);
friendbooloperator == (const Fraction& f1, Fraction& f2);
public:
Fraction();
Fraction(int n, int d=1);
void Input(); // input a fraction from keyboard.
void Show() const; // Display a fraction on screen
int GetNumerator() const;
int GetDenominator() const;
bool SetValue(int n, int d=1);
double Evaluate() const; // Return the decimal value of a fraction
private:
int numerator; // may be any integer
int denominator; // should always be positive
};
Your operator definition is wrong. You're attempting to do
if (f1==f2)
in the middle of your definition of that "==" operator. This is recursive. In fact, it's infinitely recursive, so the crash is probably happening because you're overfilling the stack.